title: "aws s3 ls" command throwing "InvalidRequest" error message. How to solve it?
body: <p>After I run <code>aws s3 ls</code> command I get below error message:-</p>
  
  <blockquote>
    <p>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".</p>
  </blockquote>
  
  <p>Below are more details and my findings that may help to answer the question:-</p>
  
  <ul>
  <li><p>The command is being executed from an EC2 Instance running in <code>ap-south-1</code> region.</p></li>
  <li><p><a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html" rel="noreferrer">This</a> Amazon doc says that new region created after Jan 30 2014 only support Signature Version 4.</p></li>
  <li><p>As suggested by error message I tried giving command <code>aws --region ap-south-1 s3 ls</code> but the this command also gives the same error message.</p></li>
  <li><p>I have run <code>yum update</code> and the AWS CLI version is latest which is <code>aws-cli/1.10.33 Python/2.7.10 Linux/4.4.11-23.53.amzn1.x86_64 botocore/1.4.23</code></p></li>
  <li><p>The above <code>aws s3 ls</code> command works absolutely fine and lists the buckets if it is executed from an us-east-1 instance.</p></li>
  </ul>