AWS
config profile error
troubleshooting
MyName profile
AWS CLI

AWS CLI error: the config profile (MyName) could not be found

Codemia Knowledge Hub ·

"The config profile (MyName) could not be found" means the AWS CLI looked for a named profile that does not exist or is configured incorrectly. Check that ~/.aws/config has a [profile MyName] section or ~/.aws/credentials has a [MyName] section, and that the name matches exactly, since profile names are case-sensitive.

Where the AWS CLI reads profiles from

The CLI uses configuration profiles to manage access keys, secret access keys and region settings. They live in the &#126;/.aws directory on Linux and macOS, or C:\Users\<YourUserName>\.aws on Windows, in two files:

  • config: named profiles and settings such as the default region.
  • credentials: profiles with access keys and secret access keys.

Example config file

ini
1[default]
2region = us-west-2
3
4[profile MyName]
5region = us-east-1
6output = json

Example credentials file

ini
1[default]
2aws_access_key_id = YOUR_DEFAULT_ACCESS_KEY
3aws_secret_access_key = YOUR_DEFAULT_SECRET_KEY
4
5[MyName]
6aws_access_key_id = YOUR_ACCESS_KEY
7aws_secret_access_key = YOUR_SECRET_KEY

Causes of the error

IssueDescriptionResolution
Profile Not FoundProfile not defined in config/credentials.Define the profile correctly.
Typographical ErrorCase-sensitive errors in profile name.Correct the name consistently.
Improper File PathIncorrect paths set for configuration files.Set environment variables appropriately.
Permission ProblemsFiles not readable by the CLI.Adjust file permissions using chmod.
Corrupted ConfigurationsSyntax errors or corruption in configuration files.Inspect and correct file entries.

Fixing it

Step 1: Check the profile name

Make sure the profile is defined and that the name in your command matches it exactly. Look for typos.

Step 2: Check both configuration files

Open config and credentials and confirm the profile definitions are correct. A missing entry or bad syntax causes CLI configuration errors.

Step 3: Check environment variables that change the file paths

The CLI can be pointed at other files with environment variables:

  • AWS_CONFIG_FILE: a custom path to the config file.
  • AWS_SHARED_CREDENTIALS_FILE: a custom path to the credentials file.
bash
export AWS_CONFIG_FILE=/custom/path/config
export AWS_SHARED_CREDENTIALS_FILE=/custom/path/credentials

If these point somewhere unexpected, the CLI won't see the profiles in ~/.aws.

Step 4: Fix file permissions

The user running the CLI must be able to read the files. Adjust permissions with chmod where needed:

bash
chmod 600 ~/.aws/config
chmod 600 ~/.aws/credentials

Example

Running a command with the MyName profile:

bash
aws s3 ls --profile MyName

returns:

 
The config profile (MyName) could not be found

Check that the config file has a correct [profile MyName] entry and that it matches the credentials file.


Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design