Search code examples
amazon-web-servicesamazon-ec2aws-security-group

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


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


Solution

  • When you first ran aws configure, it just populated the local credentials in %UserProfile%\.aws\credentials; it didn't validate them with AWS.

    (aws-cli doesn't know what rights your user has until it tries to do an operation -- all of the access control happens on AWS's end. It just tries to do what you ask, and tells you if it doesn't have access, like you saw.)

    That said, if you're running the CLI from an AWS instance, you might want to consider applying a role to that instance, so you don't have to store your keys on the instance.