Location of the shared config and credentials files - AWS SDKs and Tools

Location of the shared config and credentials files

The shared AWS config and credentials files are plaintext files that reside by default in a folder named .aws that is placed in the "home" folder on your computer.

On Linux and macOS, this is typically shown as ~/.aws. On Windows it is %USERPROFILE%\.aws.

Operating system Default location of files
Linux and macOS

~/.aws/config

~/.aws/credentials

Windows

%USERPROFILE%\.aws\config

%USERPROFILE%\.aws\credentials

A ~/ or ~ followed by the file system's default path separator at the start of the path is resolved by checking, in order,

  1. (All Platforms) The HOME environment variable.

  2. (Windows Platforms) The USERPROFILE environment variable.

  3. (Windows Platforms) The HOMEDRIVE environment variable prepended to the HOMEPATH environment variable (ie. $HOMEDRIVE$HOMEPATH).

  4. (Optional per SDK or tool) An SDK or tool-specific home path resolution function or variable.

When possible, if a user's home directory is specified (e.g. ~username/) at the start of the path, it is resolved to the requested username's home directory (e.g. /home/username/.aws/config).

Changing the default location of these files:

The following environment variables can be set to change the location or name of these files from the default to a custom value

  • config file environment variable: AWS_CONFIG_FILE

  • credentials file environment variable: AWS_SHARED_CREDENTIALS_FILE

Linux/macOS

You can specify an alternate location by running the following export commands on Linux or macOS.

$ export AWS_CONFIG_FILE=/some/file/path/on/the/system/config-file-name $ export AWS_SHARED_CREDENTIALS_FILE=/some/other/file/path/on/the/system/credentials-file-name
Windows

You can specify an alternate location by running the following setx commands on Windows.

C:\> setx AWS_CONFIG_FILE c:\some\file\path\on\the\system\config-file-name C:\> setx AWS_SHARED_CREDENTIALS_FILE c:\some\other\file\path\on\the\system\credentials-file-name