codefx
codefx

Reputation: 10502

How to set --region with aws cli commands?

I am trying to run the following command:

aws s3 cp --region ap-south-1 --acl public-read my.exe s3://bucket/binaries/my.exe

upload failed: ./my.exe to s3://bucket/binaries/my.exe A client error (InvalidRequest) occurred when calling the PutObject 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 do I fix this error? I also tried the

AWS_DEFAULT_REGION=ap-south-1 aws s3 cp --acl public-read my.exe s3://bucket/binaries/my.exe

but with no luck.

# aws --version
aws-cli/1.10.28 Python/2.7.9 Linux/3.16.0-4-amd64 botocore/1.4.19

Upvotes: 0

Views: 13323

Answers (2)

mudasar nazeer
mudasar nazeer

Reputation: 1

(type on cli): aws configure (it will let you update keys,secret keys,region,output-format)

Upvotes: -1

codefx
codefx

Reputation: 10502

It seems to be working after upgrading awscli.

pip install --upgrade awscli

aws --version
aws-cli/1.10.43 Python/2.7.9 Linux/3.16.0-4-amd64 botocore/1.4.33

Upvotes: 2

Related Questions