An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
AWS profile chooser
Super short AWS hint.
Having different AWS profiles, I do not want to pick default one just because I forgot --profile
command line option.
Just looking for a way of forcing me having to choose an AWS profile before issuing any command.
My solution was (for bash only):
Removing default profile in ~/.aws/credentials
No command will work from now on without a--profile
or an AWS_PROFILE environment variableCreating a one-liner alias for choosing the desired profile and setting $AWS_PROFILE environment variable.
An alias let me reuse the same shell I'm in.
alias aws-profile-chooser='x() { select prof in $( aws configure list-profiles ) ; do export AWS_PROFILE="$prof"; break; done }; x'
(you can see the gist here)
This command will show me available profiles, and after choosing the right one, it will set AWS_PROFILE environment variable.
$ aws-profile-choose 1) default2) amplify-udemy3) aws-lambda-deploy4) test-aws#?
From now on if I forget to choose a profile, any command will break.
Choosing and setting an AWS profile...is now a breeze! ;)
Original Link: https://dev.to/andreav/aws-profile-chooser-4ekf
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To