Manage your AWS profiles

I am working on multiple projects with different clients, each of them have their own AWS account. AWS infrastructure requires aws credential, that’s mean I will have many credentials.

So, the question is: How I manage credentials and switch credentials easily?

Run the command to store credentials to a specific profile.

1
2
3
aws configure --profile projectA # enter the secret & access key

aws configure --profile projectB # enter the secret & access key

I have many profiles, hence switching profiles is the first step before I run any AWS CLI commands. To switch profile, I will run

1
export AWS_DEFAULT_PROFILE=projectA

After the export command, right now I can run any AWS CLI commands I want.