Last modified March 20, 2025

AWS CLI Credentials & Config chain

If you use the AWS CLI tool for your operations and application implementation, it’s important to note that the CLI searches for credentials and configuration data in a specific hierarchical order.

Command Line Options

For example: using options like “–profile”, “–region”, “–output” etc…

If the necessary data is not found through command line options, the CLI will check for environmental variables.

Environmental Variables

AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY

AWS_SESSION_TOKEN

AWS_DEFAULT_REGION

… and so on. If the data is still not found, the CLI will look for it in the CLI credentials file, which can be found at the following locations:

  1. For Linux: ~/.aws/credentials

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

Finally, if the data is still not found, the CLI will search for it in the CLI configuration file, which can be found at the following locations:

  1. For Linux: ~/.aws/config

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