After I run
aws s3 ls command I get below error message:-
A client error (InvalidRequest) occurred when calling the ListBuckets
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”.
Below are more details and my findings that may help to answer the question:-
- The command is being executed from an EC2 Instance running in
- This Amazon doc says that new region created after Jan 30 2014 only support Signature Version 4.
- As suggested by error message I tried giving command
aws --region ap-south-1 s3 lsbut the this command also gives the same error message.
- I have run
yum updateand the AWS CLI version is latest which is
aws-cli/1.10.33 Python/2.7.10 Linux/4.4.11-23.53.amzn1.x86_64 botocore/1.4.23
- The above
aws s3 lscommand works absolutely fine and lists the buckets if it is executed from an us-east-1 instance.
You need to update
aws cli to latest version(v1.11.84 at the time of writing).
yum update is not working then try following this Guide to install AWS CLI
The reason behind this error is, in newer regions AWS S3 doesn’t support Lower Signature Version.