Credentials set in the shared credentials file
Use aws configure to create an access credentials file with the default profile.
Create Credentials
Example: Command output of 'aws configure'
$ aws configure
AWS Access Key ID [None]: #AKIAIOSFODNN7EXAMPLE# 1
AWS Secret Access Key [None]: #wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY# 2
Default region name [None]: 3
Default output format [None]: #json# 4
1 The Access Key will be stored in ~/.aws/credentials
2 The Secret Access Key will be stored in ~/.aws/credentials
3 The region does not need to be set. The user can press the Return key to skip this. The Region will be stored
in ~/.aws/config
4 The output format will be stored in ~/.aws/config
Note: For more information, see Configuring the AWS Command Line Interface on
Amazon.
To support multiple identities, AWS credential files can use Named Profiles.
Use aws configure — profile {profileName} to create an access credentials file with a named profile. Extra named profiles are appended to the ~/.aws/credentials.
Example: Command output of 'aws configure --profile pool2'
$ aws configure --profile pool2
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE 1
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 2
Default region name [None]: 3
Default output format [None]: json 4
1 The Access Key will be stored in ~/.aws/credentials.
2 The Secret Access Key will be stored in ~/.aws/credentials.
3 The region does not need to be set. The user can press the Return key to skip this. The region will be stored
in ~/.aws/config.
4 The output format will be stored in ~/.aws/config.
Example: Contents of the AWS credentials file (~/.aws/credentials)
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
[profile pool2] 1
aws_access_key_id = N67W90RKLCWOLPSKN8W8
aws_secret_access_key = RlfTDyqPg0WnY/PWdxMEe/gjuG7QRckynofRMwwR
1 The pool2 profile offers another set of Access Credentials for an S3 connection.
Example: Contents of the AWS credentials file (~/.aws/credentials)
[profile pool2] 1
aws_access_key_id = N67W90RKLCWOLPSKN8W8
aws_secret_access_key = RlfTDyqPg0WnY/PWdxMEe/gjuG7QRckynofRMwwR
1 The pool2 profile offers another set of Access Credentials for an S3 connection.
Example: Contents of the AWS configuration file (~/.aws/config)
[default]
output=json
[profile pool2]
output=text
Use default credentials
To use the default credentials, use the following example.
Example: List buckets in a default connection
$ aws s3 ls
Use credentials from a named profile
To use a named profile, add the --profile option to your command.
Example: List buckets in a named profile connection. This example lists buckets
using the pool2 profile
$ aws --profile pool2 s3 ls