How to change the AWS account using the Elastic Beanstalk CLI

Bpn's answer is correct just add the next step to avoid spending time as I did..

After updating the ~/.aws/config file, just run:

eb init --profile <profilename>

in order to switch between the account.

(in this case profilename = eb-cli2)


I had to add a new profile to this file ~/.aws/config. Example of the file with 2 profiles:

[profile eb-cli]
aws_access_key_id = XXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXX

[profile eb-cli2]
aws_access_key_id = XXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXX

Also make sure to update the profile value in your application .elasticbeanstalk/config.yml