How to setup the AWS CLI for multiple profiles
The AWS CLI provides the ability to use the wide range of Amazon Web Services tools and services straight from the command-line.
However, sometimes it’s useful to be able to login to multiple AWS accounts. Luckily, this is possible by adding an additional profile
to your local configuration and then specifying it when making calls to respective services.
Update your local credentials
Step 1. ~/.aws/credentials
Fill in your own details for the second grouping, mine is called andrew
.
Update your local config
Step 2.~/.aws/config
Fill in your own details for the second grouping, mine is called andrew
.
Run a test command
Step 3. Run a command
aws sts get-caller-identity --profile andrew
You can find more information about this on the AWS documentation over here: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles