Coder Social home page Coder Social logo

omf-plugin-asp's Introduction

asp

A plugin for Oh My Fish.

MIT License Fish Shell Version Oh My Fish Framework


Enables quick switching between AWS profiles.

Prerequisites

Install

omf install [email protected]:mgoodness/plugin-asp.git

Usage

Set profile

asp <aws_profile> [region]

asp - AWS Set Profile

Sets $AWS_PROFILE and $AWS_DEFAULT_PROFILE variables.
The optional region value can be used if you wish to override the default region configured for the profile.

Get selected profile

agp

agp - AWS Get Profile

Echoes $AWS_PROFILE and $AWS_DEFAULT_REGION.

Clear selected profile

acp

acp - AWS Clear Profile

Clears variables for selected profile and assumed role.

Assume role

aar <role_arn>

aar - AWS Assume Role

Performs STS Assume Role call and sets obtained $AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY and $AWS_SESSION_TOKEN variables.

To clear assumed role variables execute either acp or asp command.

License

MIT © Michael Goodness et al

omf-plugin-asp's People

Contributors

m-radzikowski avatar mgoodness avatar sergiopatino avatar topplethenun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

omf-plugin-asp's Issues

Setting just AWS_PROFILE and using ~/.aws/config file

This is a very useful plugin, a must-have for AWS developers. But I found using it much more obstructive than it's zsh counterpart: https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/aws/aws.plugin.zsh

The problem

From what I see this plugin reads ~/.aws/configuration file to extract credentials and performs sts assume-role call to set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN. This has a drawback of role-based credentials expiration after an hour, like it's mentioned in the readme.

But more important is that according to AWS docs the proper configuration should look like this (see https://docs.aws.amazon.com/cli/latest/topic/config-vars.html and https://docs.aws.amazon.com/credref/latest/refdocs/setting-global-source_profile.html):

# In ~/.aws/credentials:
[development]
aws_access_key_id=foo
aws_secret_access_key=bar

# In ~/.aws/config
[profile crossaccount]
role_arn=arn:aws:iam:...
source_profile=development

Right now having this configuration will result in asp error Invalid ... profile in ...

Probably the same case will be when using SSO in AWS CLI v2 (although I cannot confirm this).

The proposition

Simplify the plugin behaviour by just setting AWS_PROFILE (and AWS_DEFAULT_PROFILE for compatibility). Look for profile names in ~/.aws/config file. This will make the plugin work more like mentioned before zsh version.

@mgoodness what do you think? If you agree I can create PR with changes. Otherwise, please let me know you do not want such changes here and I probably will release this as a separate plugin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.