A plugin for Oh My Fish.
Enables quick switching between AWS profiles. Supports both hard-coded keys and role assumption. Works with the aws plugin by @sagebind.
$ omf install git@github.com:mgoodness/plugin-asp.git
$ asp <aws_profile> [region]
Sets $AWS_ACCESS_KEY_ID
and $AWS_SECRET_ACCESS_KEY
environment variables to
the corresponding values from ~/.aws/credentials
. If keys are not listed in the
profile, attempts to assume the profile's role_arn
and uses the returned keys.
Also sets $AWS_DEFAULT_REGION
and $AWS_DEFAULT_PROFILE
.
The optional region value can be used if you wish to override the default region
configured in your ~/.aws/credential
file..
$ agp
Echoes $AWS_DEFAULT_PROFILE
and AWS_DEFAULT_REGION
.
~/.aws/credentials
[default]
output = json
region = us-east-1
aws_access_key_id = <ACCESS_KEY>
aws_secret_access_key = <SECRET_KEY>
[prod]
output = json
region = us-east-1
role_arn = arn:aws:iam::<ACCOUNT_NUMBER>:role/<PROD_ROLE_NAME>
source_profile = default
[stage]
output = json
region = us-east-1
role_arn = arn:aws:iam::<ACCOUNT_NUMBER>:role/<STAGE_ROLE_NAME>
source_profile = default
- Role-based credentials expire after one hour.
MIT © Michael Goodness et al