Using multiple AWS Accounts from command line

A common mistake like launching and creating an app to different account can be happen when anyone managing multiple AWS account at a time.

You can easily manage that by configuring command line interface to interact with AWS such as your security credentials and the default region, profile name.

To overcome the difficulty, Create a AWS config file ~/.aws/config with following lines:


[profile profile_name_of_account_name_A]
aws_access_key_id = account_A_access_key
aws_secret_access_key = account_A_secret_key


[profile profile_name_of_account_name_B]
aws_access_key_id = account_B_access_key
aws_secret_access_key = account_B_secret_key

Now, simply run a command like:

eb init --profile profile_name_of_account_name_A

Click here to know more about configuring multiple AWS accounts to use with command line.

Leave a Comment