Irfan Y
Irfan Y

Reputation: 1310

aws cli signature version 4

I want to move all my data from Bucket1 of account A to Bucket2 of account B.

For this:

  1. I downloaded AWS CLI for Windows.

  2. Entered IAM credentials using command aws configure (these credentials are from account B)

  3. Run command to sync buckets: aws s3 sync s3://Bucket1 s3://Bucket2

    I received following error:

fatal error: An error occured (InvalidRequest) when calling the ListObject operation: You are attempting to operate on a bucket in a region that requires Signature Version 4. You can fix this issue by explicitly providing the correct region location using the --region argument, the AWS_DEFAULT_REGION environment variable, or the region variable in the AWS CLI configuration file. You can get the bucket's location by running "aws s3api get-bucket-location --bucket BUCKET".

How to tackle this error?

aws --version
aws-cli/1.11.61 Python/2.7.9 windows/8 botocore/1.5.24

Upvotes: 4

Views: 6264

Answers (2)

Impermanence
Impermanence

Reputation: 184

Look for the correct region of the bucket (see attached image).
Try the command below by specifying the correct region:

aws s3 ls --region us-west-2

enter image description here

S3 is global - don't let that mislead you.

Upvotes: 1

Irfan Y
Irfan Y

Reputation: 1310

My S3 url was like :https://console.aws.amazon.com/s3/home?region=us-east-1 so I supposed that us-east-1 is my region but actually it was not!

I used AWS command to find Bucket2 region and it told me a different region.

Then I used this command aws s3 sync s3://Bucket1 s3://Bucket2 --region Asia Pacific (Mumbai) and everything worked fine!

Upvotes: 2

Related Questions