AWS CLI Credentials & Config Chain

How does AWS CLI Credentials & Config chain work?

If you are using AWS CLI tool for your operations and design implementation/application, 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\\.aws\credentials

4. CLI Configuration File 

For Linux: ~/.aws/config

For Windows: C:\Users\\.aws\config