Last updated: Feb 26, 2024
Reading time·2 min

The "config profile could not be found" error occurs when you try to run an AWS CLI command with a profile that is not configured in your AWS credentials file.

The most common scenarios are:
the value passed to the --profile parameter has been misspelled or the
profile isn't configured in the AWS credentials file.
the environment variable AWS_PROFILE has been set and points to a profile
that isn't present in the AWS credentials file.
When set, the AWS_PROFILE
environment variable overrides the
behavior of using the default AWS profile.
To solve the "the config profile could not be found" error:
AWS_PROFILE environment variable is set on the machine and
either unset it or set it to a profile that exists in your credentials
file. To print the environment variable, use the following commands,
depending on your operating system:# on Linux and macOS echo $AWS_PROFILE # on Windows with CMD (Command Prompt) echo %AWS_PROFILE% # on Windows with PowerShell echo $Env:AWS_PROFILE
aws configure command and set the credentials for the profile.# for the default profile aws configure # for a profile named admin aws configure --profile admin
The aws configure command writes the security credentials of the profile to:
~/.aws/credentials file on Linux and macOS.C:\Users\USERNAME\.aws\credentials on Windows.In case you're unable to run the aws configure command and get an error,
make sure to update the version of the AWS CLI you're using, or edit the
credentials file directly.
The syntax of the credentials file should look as follows.
[default] aws_access_key_id=YOUR_ACCESS_KEY_ID aws_secret_access_key=YOUR_SECRET_ACCESS_KEY [admin] aws_access_key_id=YOUR_ACCESS_KEY_ID aws_secret_access_key=YOUR_SECRET_ACCESS_KEY
The region and output format settings are stored in the config file in the
same directory.
This is ~/.aws/config on Linux and macOS and C:\Users\USERNAME\.aws\config
on Windows.
The syntax of the config file should look similar to the following.
[default] region = eu-central-1 output=json [profile admin] region=eu-central-1 output=json
You can learn more about the related topics by checking out the following tutorials: