Switching AWS accounts

Martin Kaschke
1 min readFeb 4, 2020

--

https://github.com/aws/aws-cli

For the following article, I assume that you are at least a little bit familiar with the awscli (https://github.com/aws/aws-cli). Otherwise, I didn’t believe this article could help you in any way. :)

When managing multiple AWS accounts from your terminal, you run in the issue of switching between different accounts to run several services in different AWS accounts.

So the first step would be to find out what accounts are currently available. If you never had the problem of using a different account, you probably have only one profile configured. So in my case, the profile called “default”.

$ cat ~/.aws/credentials
[default]
aws_access_key_id=AAAAA
aws_secret_access_key=BBBBB

If you now have to add another AWS account, you specify the configuration with a profile name.

$ aws configure --profile martin
AWS Access Key ID [AAAAA]:
AWS Secret Access Key [BBBB]:
Default region name [eu-central-1]:
Default output format [None]:

During the process of setting up a new service, you will now be asked to specify the profile (choose from the list) for the service.

--

--

Martin Kaschke
Martin Kaschke

No responses yet