Search code examples
amazon-web-servicesamazon-s3amazon-ec2serveramazon-iam

How do I fix this AWS Error while connecting AWS EC2 Server and AWS S3 Storage Files (InvalidAccessKeyId)?


I am using the windows command prompt with the AWS Command Line Interface to connect the AWS S3 storage files and EC2 Server, I typed the following info (Part 1) and got an error (Part 2).

Part 1

AWS Access Key ID: (I put the EC2 Key pair name) AWS Secret Access Key ID: (I put the key pair) Default region name: us-east-2 Default output format: All (according to EC2 Security > Outbound Rules > Protocol)

Part 2

C:\Users(username)>aws s3 ls s3://www.(domain name)

An error occurred (InvalidAccessKeyId) when calling the ListObjectsV2 operation: The AWS Access Key Id you provided does not exist in our records.


Solution

  • AWS Access Key ID: (I put the EC2 Key pair name) AWS Secret Access Key ID: (I put the key pair)

    As @Anon Coward says, Ec2 Key pair is totally separate from AWS API access key / secret.

    Go to IAM for your IAM user and generate a new IAM Access Key then rerun aws configure and paste in the values it gives you. The access key will look like AKIA..... and the secret will be a bunch of random looking characters.