The AWS “config profile could not be found” error means the profile name in your CLI or tool does not match any saved profile on your machine.
What Aws The Config Profile Could Not Be Found Means
When the AWS command line or a tool prints aws the config profile could not be found, it is telling you that it tried to load a named profile, failed to match that name in your local AWS settings, and stopped before sending any request to AWS. The command never reaches your account because the tool has no login details to work with.
This message appears with many AWS tools: the AWS CLI, SDK based scripts, the AWS CDK, Terraform providers, and desktop clients that hook into the same profile files. All of them rely on the same small set of files and variables on your machine to find the right access keys and region.
To solve this error in a stable way, you need to line up three things: the profile name in your command, the profile entries saved on disk, and the profile name picked up by your shell variables. Once those three match, the message stops and your commands start to run again.
Common Causes Of Aws Config Profile Not Found Message
This AWS config profile problem nearly always comes from a simple mismatch. The tool is not broken; it just can not see a profile with the name you asked for. Several small slips can trigger that situation during normal work.
Missing Or Misspelled Profile Name
If the profile name used with --profile in your command does not exist in the AWS config files, the tool raises this error. A single extra dash, a plural where your files use singular, or a stray number at the end is enough to break the match.
Profile Saved In One File But Not The Other
The AWS CLI uses two text files in the .aws folder under your home directory. One holds regions and names, the other holds access keys. When a profile exists in only one of those files, the name lookup can succeed while the credentials lookup fails, which leads to the same message.
Aws Profile Name Set In A Shell Variable
Many users set an AWS profile name in a shell variable such as AWS_PROFILE or AWS_DEFAULT_PROFILE. When that variable points to a profile that no longer exists, every command without an explicit --profile flag starts to fail with this config profile error.
Running Commands From A Different User Account
On shared machines or build agents, the AWS config files for each user live under that user’s home folder. When a script runs under a different login, it often can not see the profiles you created under your own login, so the tool raises the profile error while your personal session looks fine.
Custom Aws Config Folder Location
The AWS CLI respects several variables that change where it looks for config files. When one of these points to an empty folder or a stale copy, your current profiles vanish from view and every load of a named profile fails.
| Cause | How It Shows Up | Quick Fix |
|---|---|---|
| Profile name typo | Error appears only for one profile name | Match the spelling in command and config |
| Profile missing in files | No hit when you list profiles | Add profile with aws configure --profile |
| Shell variable points to bad name | Every command fails without --profile |
Fix or clear the AWS_PROFILE value |
| Wrong user account | Works in one shell, fails in another | Create the profile for the active user |
| Custom config folder path | Config files look empty or new | Point the path variables to the right folder |
Quick Checks To Fix The Config Profile Error
Before you edit files by hand, you can run a few commands to see what the AWS CLI thinks your profiles look like. These checks give you a clear view of the current state on your machine.
- List known profiles — Run
aws configure list-profilesto see every profile name that the CLI can see right now. - Check active profile — Run
echo $AWS_PROFILEon macOS or Linux, orecho %AWS_PROFILE%on Windows, to see whether a fixed profile name is set in a shell variable. - Check config path — Run
echo $AWS_CONFIG_FILEandecho $AWS_SHARED_CREDENTIALS_FILEto check for custom file paths that might point away from your real config folder. - Run a test call — Use
aws sts get-caller-identity --profile your-profileto see whether a given profile works when you call AWS.
After these checks, you usually know whether the problem is a missing profile, a stale shell variable, or an unexpected config path. From there you can pick the matching fix in the next sections.
Fixes For Aws Config Profile Not Found On Each Platform
The shape of the fix is the same on every system, but the folder paths and shell commands look slightly different. This section walks through the steps on Windows, macOS, and Linux so you can match them to your setup.
Fixing Profiles On Windows
On Windows, the AWS CLI stores config files under the user home folder, usually at C:\\Users\\<UserName>\\.aws. Inside that folder you should see a config file and a credentials file. Both are plain text and can be opened in a simple editor.
- Open the aws folder — Press Win + R, type
%UserProfile%\\.aws, and press Enter to open the folder. - Check profile blocks — Open
configand find sections such as[profile my-user]. The text inside the brackets is the name you pass to--profile. - Align names — Make sure the profile name in your commands matches the name in both
configandcredentials. Adjust the section headers if needed. - Add missing profile — If the profile is not present at all, run
aws configure --profile my-userin a terminal and supply access key id, secret access key, and region. - Clear bad shell variable — In a Command Prompt, run
set AWS_PROFILE=to clear a stale profile value, then open a new shell and try the command again.
Fixing Profiles On Macos And Linux
On macOS and Linux, the AWS CLI uses the .aws folder under your home directory. You can reach it from a terminal with cd ~/.aws. Inside you should see the same pair of text files: config and credentials.
- Open the folder — Run
cd ~/.awsthenlsto check that the config files exist. - View config entries — Run
cat configto see sections such as[profile my-user]and a possible[default]section. - View credential entries — Run
cat credentialsand check that every profile section here has a matching section name in the config file. - Align section names — If the name in one file lacks the
profileprefix or uses different spelling, adjust the section headers so the names match. - Reset shell variable — Run
unset AWS_PROFILEin the current shell or adjust your shell startup file to remove a stale profile setting.
Correcting Custom Config Paths
Some setups move AWS config files into a shared folder, a dotfiles repo, or a managed path. In these cases you often have extra variables such as AWS_CONFIG_FILE and AWS_SHARED_CREDENTIALS_FILE set in your shell startup scripts.
- Print path variables — Run the echo commands from the quick checks section again and note any custom paths.
- Verify files exist — Use
lsor the file manager to confirm that the target path contains config and credentials files with the expected profile sections. - Point paths to real files — If the files live elsewhere, update the path values in your shell startup script to match the folder that holds your active profiles.
- Reload shell — Close and reopen your terminal or run a shell reload command so the new path settings apply to fresh sessions.
Dealing With Aws Tools That Use Profiles
Many higher level tools sit on top of the AWS CLI and use the same profile names under the hood. When this profile error appears in log output from these tools, the core cause is still a profile name issue.
Aws Cdk And Iaac Tools
The AWS CDK, Terraform, and similar tools often pass a profile name straight through to the AWS SDK. When a stack deploy fails with the profile error, check the profile flag in the tool command or config file and make sure it matches a profile that the AWS CLI can run with the caller identity test.
Language Sdks And Local Scripts
Code written with AWS SDKs for languages such as Python, JavaScript, or Go can use named profiles by passing a profile name into the client builder or by reading a shell variable. In those scripts, the fix is the same: update the profile name in the code, or create a matching entry in your config and credentials files.
Gui Tools And Third Party Clients
Some GUI tools read the same AWS profile files instead of holding their own copy of keys. When these tools raise profile errors, open their settings screen and check any profile name or path fields. Align those fields with the working names and paths in your AWS CLI checks so the GUI and CLI share the same profile set.
Habits To Avoid This Aws Profile Error Next Time
Once you fix the current problem, a few simple habits can cut down on repeats of this config profile message in daily work. These habits keep profile names clean and visible, and reduce the chance that a silent change in a script or shell file breaks your setup later.
- Pick stable profile names — Choose short, clear profile names and stick to them across tools so that commands and scripts stay aligned.
- Document active profiles — Keep a short markdown file in your repo or home folder that lists profile names, AWS accounts, and roles tied to each one.
- Use caller identity tests — Run the STS caller identity command when you add or edit a profile so you know it works before you run heavier commands.
- Avoid hard coded paths — Use the default
.awsfolder layout when you can so team members and build agents share the same expectations. - Review shell startup files — Scan your shell startup scripts now and then for AWS related variables that might point to old profiles or paths.
With these fixes and habits in place, the aws the config profile could not be found error should fade into the background and stay out of your way while you run commands, script deployments, and ship changes to your AWS accounts in daily use.
