I understand the AWS CLI can make use of the config
and credentials
files for storing it's local profile configurations.
Does anyone know of any general guidance and or best practice with regards to what should go in each file?
The AWS CLI stores sensitive credential information that you specify with aws configure in a local file named credentials , in a folder named . aws in your home directory. The less sensitive configuration options that you specify with aws configure are stored in a local file named config , also stored in the .
The shared AWS config and credentials files contain a set of profiles. A profile is a set of configuration values that can be referenced from the SDK/tool using its profile name. Configuration values are attached to a profile in order to configure some aspect of the SDK/tool when that profile is used.
The credentials file is located at ~/. aws/credentials on Linux or macOS, or at C:\Users\ USERNAME \. aws\credentials on Windows. This file can contain the credential details for the default profile and any named profiles.
While signed into the portal, choose the AWS Accounts icon to expand the list of accounts. Choose the AWS account from which you want to retrieve access credentials. Then, next to the IAM role name (for example Administrator), choose Command line or programmatic access.
The AWS documentation which covers the two files can be found under Configuration and Credential Files in the AWS CLI documentation.
To summarise:
credentials
file is intended for storing just credential information for the configured profiles. (Currently limited to: aws_access_key_id
, aws_secret_access_key
and aws_session_token
)config
file is intended for storing non-sensitive configuration options for the configured profiles.config
file can also be configured to contain any information which could also be stored in the credentials
file.config
and credentials
file, those in the credentials
file will take precedence.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With