Where Are AWS CLI Credentials Stored?
AWS ~/.aws credentials and config files on every OS, with profiles and SSO cache notes.
Last updated
The AWS CLI keeps access keys in a credentials file and region/output defaults in a config file, both inside .aws in your home folder on every OS.
Profiles split accounts into named sections. SSO logins cache tokens in an sso/cache subfolder that expires hourly, which explains repeated browser prompts.
Where AWS CLI stores this, by platform
%USERPROFILE%\.aws\credentials
config sits beside it. Never commit these files; a leaked secret key bills to your account within minutes.
~/.aws/credentials
Same layout. Keep the folder at owner only permissions even though macOS home dirs default sensibly.
~/.aws/credentials
Same layout. Env vars override files, so check those when the CLI ignores your profiles.
Frequently asked questions
How do I use two AWS accounts on one machine?
Add named profiles to credentials and config, then select with the profile flag or env var per command.
Why does AWS SSO keep asking me to log in?
The sso/cache token expired (usually hourly). Re run the login command; nothing is broken.
Notice an outdated path? Let us know.