I created a new Access Key and configured that in the AWS CLI with aws configure
. It created the .ini
file in ~/.aws/config
. When I run aws s3 ls
it gives:
A client error (InvalidAccessKeyId) occurred when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records.
AmazonS3FullAccess
policy is also attached to the user. How to fix this?
Choose your account name in the navigation bar, and then choose My Security Credentials. If you see a warning about accessing the security credentials for your AWS account, choose Continue to Security Credentials. Expand the Access keys (access key ID and secret access key) section. Choose Create New Access Key.
Access Key ID and Secret Access Key are for API/CLI/SDK access. For IAM sign-in dashboard, you need the username and password. When a new IAM user is added, the user gets the username, password, access key and secret key, and the IAM URL from the IAM admin. You can understand this better with the AWS training.
To remove a setting, use an empty string as the value, or manually delete the setting in your config and credentials files in a text editor. You can retrieve any credentials or configuration settings you've set using aws configure get . Specify the profile that you want to view or modify with the --profile setting.
It might be happening that you have the old keys exported via env variables (bash_profile) and since the env variables have higher precedence over credential files it is giving the error "the access key id does not exists".
Remove the old keys from the bash_profile and you would be good to go.
Happened with me once earlier when I forgot I have credentials in bash_profile and gave me headache for quite some time :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With