Switch AWS IAM Roles to set envriomnent variables.
This plugin use these command line tools.
- aws/aws-cli: Universal Command Line Interface for Amazon Web Services
- stedolan/jq: Command-line JSON processor
- jorgebucaran/fish-getopts: Parse CLI options in fish.
Use fisher
fisher add jorgebucaran/fish-getopts
fisher add cm-wada-yusuke/aws_swrole
aws_swrole [-o] <aws profile>
- Print AWS_XXX environments commands with -o option.
- Without -o option to set AWS_XXX environments.
$ aws_swrole
Usage: swrole [-o] <aws profile>
Defined profiles:
development
test
staging
production
$ aws_swrole development
Enter MFA code > 123456
$ aws dynamodb list-tables --region ap-northeast-1
{
"TableNames": [
"Movies"
]
}
$ aws_swrole -o test
Enter MFA code > 123456
set -x AWS_ACCESS_KEY_ID XXXXXXXXXXXXXXXXXX
set -x AWS_SECRET_ACCESS_KEY YYYYYYYYYYYYYYYYYYYYYYYY
set -x AWS_SESSION_TOKEN ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ