The AWS Access Key ID does not exist in our records [Fixed]

avatar
Borislav Hadzhiev

Last updated: Feb 26, 2024
2 min

banner

# The AWS Access Key ID does not exist in our records

The "AWS Access Key ID does not exist in our records" error occurs when the access key ID configured for the AWS CLI is invalid.

access key not exist

To solve the error:

  1. Verify whether you're setting the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables and make sure the values are correct:
shell
# Linux and macOS echo $AWS_ACCESS_KEY_ID echo $AWS_SECRET_ACCESS_KEY # on Windows with CMD echo %AWS_ACCESS_KEY_ID% echo %AWS_SECRET_ACCESS_KEY% # on Windows with PowerShell echo $Env:AWS_ACCESS_KEY_ID echo $Env:AWS_SECRET_ACCESS_KEY

If the environment variables are set, they have higher precedence and override the values in the AWS credentials file.

  1. If the environment variables aren't set, verify the value of the aws_access_key_id variable in your credentials file.

    The credentials file is located at ~/.aws/credentials on Linux and macOS and at C:\Users\USERNAME\.aws\credentials on Windows.

The syntax of the credentials file should look as follows.

credentials
[default] aws_access_key_id=YOUR_ACCESS_KEY_ID aws_secret_access_key=YOUR_SECRET_ACCESS_KEY [admin] aws_access_key_id=YOUR_ACCESS_KEY_ID aws_secret_access_key=YOUR_SECRET_ACCESS_KEY
Make sure you don't enclose the value of your aws_access_key_id or aws_secret_access_key in single, nor double quotes.

If you want to reconfigure the credentials for the AWS profile, run the aws configure command.

shell
# configure the default profile aws configure # configure the admin profile aws configure --profile admin
  1. When working with temporary credentials, issued by the Security Token Service API, the response includes the access/security keys and a session token. Make sure you set the value for all 3 variables in your subsequent API request.

    Omitting the value of the session token often causes this error.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.