Unable to find .aws directory
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
If a tool says it cannot find the .aws directory, it usually means it is looking for AWS CLI or SDK configuration in the current user's home directory and not finding it there. The problem is often not that AWS is broken, but that the process is running under a different user, home path, or environment than you expected.
The .aws directory normally contains credentials and config, and many AWS tools look there by default unless you override the path explicitly.
Where the .aws Directory Normally Lives
On macOS and Linux, the default location is:
On Windows, the equivalent is usually:
Inside that directory, the two most common files are:
The credentials file stores access keys, and the config file stores profile settings such as region and output format.
Create It with aws configure
If the directory does not exist yet, the easiest way to create it is:
That command prompts for values and writes the files automatically.
A typical credentials file looks like this:
And a simple config file:
Check Which User and Home Directory the Process Uses
A very common cause is that the command is not running as the user you think it is. For example, a script running under sudo, a CI runner, or a Docker container may have a different home directory.
On Unix-like systems, check this first:
If HOME points somewhere unexpected, the tool may be looking for .aws in the wrong place.
Environment Variables Can Override the Default
AWS tools also support environment variables that bypass the default directory lookup.
This is useful in containers, CI pipelines, or unusual home-directory setups. It is also a good diagnostic step: if the default lookup fails, pointing the process explicitly at the files often confirms the root cause.
Containers and CI Are Frequent Sources of Confusion
In Docker, the host machine's ~/.aws directory does not magically appear inside the container. You either mount it or inject credentials another way.
Example:
In CI, the environment may not even have a normal home directory layout, so environment variables or explicit credentials injection are often the correct approach.
Check Permissions Too
If the directory exists but the process cannot read it, permissions may be the issue.
This matters most when files were created by another user or copied from a different machine.
A Practical Debugging Order
When you hit this error, check in this order:
- does
~/.awsactually exist for the current user - does the process run under the user you expect
- is
HOMEpointing where you think it is - are
AWS_SHARED_CREDENTIALS_FILEorAWS_CONFIG_FILEoverriding the path - in containers or CI, was the config mounted or injected at all
That sequence usually finds the problem quickly.
Common Pitfalls
- Assuming the current shell user and the running process user are the same.
- Using
sudoand forgetting that the home directory changes. - Expecting host AWS credentials to exist automatically inside a container.
- Creating
credentialsbut forgetting theconfigfile or region settings when the tool needs them. - Debugging AWS auth logic before verifying the actual file path lookup.
Summary
- The
.awsdirectory usually lives under the current user's home directory. - It commonly contains
credentialsandconfig. - '
aws configureis the easiest way to create it.' - Many "cannot find
.aws" problems are really user, home-directory, container, or CI environment issues. - Environment variables such as
AWS_SHARED_CREDENTIALS_FILEandAWS_CONFIG_FILEcan override the default lookup when needed.

