How does AWS CLI Credentials & Config chain work?

If you are using AWS CLI tool for your operations and design implementation/application, please note that the CLI will look for credentials & Config data in the following hierarchical order

 

1. Command Line Options - 

For example: using options like "--profile", "--region", "--output" etc...

 

2. Environmental Variables - 

AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY

AWS_SESSION_TOKEN

AWS_DEFAULT_REGION and so on...

 

3. CLI Credentials file - 

For Linux: ~/.aws/credentials

For Windows: C:\Users\<user-name>\.aws\credentials

 

4. CLI Configuration file - 

For Linux: ~/.aws/config

For Windows: C:\Users\<user-name>\.aws\config

Have more questions? Submit a request