CLI command "describe-instances" throw error "An error occurred (AuthFailure) when calling the

Viewed 6125

I was able to install CLI on windows 16 AWS instance. when I try "aws ec2 describe-instances" CLI command, I get the following error

CLI command "describe-instances" throw error "An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials"

In .aws\config file I have following content:

[default]
   region = us-west-2

How can authorization fail when it took my access key id and secret access key without any issue.

AuthFailure

6 Answers

I deleted my two configuration files from .aws directory and re-ran "aws config" That fixed the problem for me.

My Steps:

  • Go to your .aws directory under Users e.g. "c:\Users\Joe\.aws"
  • Two files: configure and credential. Delete both files
  • Rerun configure: "aws configure"

Note when you run aws configure you will need the AWS Access and Secret Key. If you don't have them you can just create another. Steps:

  • Goto "My Security Credentials" Under you Account Name in AWS Console.
  • Expand Access Key panel.
  • Create New Access Key.

Verify if your datetime is sync ok.

use: ntpdate ntp.server

bests

I tried setting that too on my windows environment. didn't work and getting error above.

so I tried setting my environment

SET AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY

SET AWS_SECRET_ACCESS_KEY=***YOUR_SECRET_ACCESS_KEY*

and then tried running command like "aws ec2 describe-instance"

I tried many things. Finally, just uninstalling and installing again (not repairing) did the trick. Just make sure to save a copy of your credentials (key and key ID) to use later when calling aws configure.

My Access and Security keys are correct. My server time was good. I got error while using Ap-south-1 region. After I changed my region to us-west-2, it worked without any problem.

Related