Last updated: Feb 26, 2024
Reading time·3 min
To see which your default AWS CLI profile is, run the aws configure list
command. The command shows the name of the default profile, the profile's
security credentials and the region.
aws configure list
We can see that the default profile's name is tester
in the example.
The configure list command also shows where the name of the default profile is set.
AWS_PROFILE
environment variable, which has higher precedence than the settings in the credentials
file.You can
find the Access Key ID and Secret Access Key
of the profile in the credentials
file.
# on Linux and macOS ~/.aws/credentials # on Windows C:\Users\USERNAME\.aws\credentials
The region
and CLI output
format for the profile are stored in the config
file in the same directory.
# on Linux and macOS ~/.aws/config # on Windows C:\Users\USERNAME\.aws\config
When an AWS CLI command is invoked, it looks for your credentials in:
Command line options - have the highest precedence and override any
environment variables or configuration
stored in config
and credentials
files.
The command line options are: --region
, --profile
and --output
.
Environment variables on the machine - have higher precedence than the
config
and credentials
files but get overridden by command line options.
The environment variables are: AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
,
AWS_DEFAULT_OUTPUT
, AWS_DEFAULT_REGION
, AWS_PROFILE
.
The config
and credentials
files on your machine - have the lowest
precedence - lower than environment variables and command line options.
Location
column when calling aws configure list
.If the command's output shows that the Type
is set to env and the Location
is an environment variable, then it gets higher precedence than the values
you've specified in your credentials
file.
To verify whether an Environment variable is set on your machine, run the echo
command that corresponds to your operating system.
# Linux and macOS echo $AWS_PROFILE # on Windows with CMD echo %AWS_PROFILE% # on Windows with PowerShell echo $Env:AWS_PROFILE
--profile
parameter, e.g. aws s3 ls --profile tester
.If you want to change your default profile, check out my other article - Set your Default Profile's Name in AWS CLI .
You can learn more about the related topics by checking out the following tutorials: