0
votes

We are performing GET bucket location call with V4 signature generated using "us-east-1" region in the following URL format:

https://s3.amazonaws.com/my-bucket-name?location

Sometimes, it returns the error in following format:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
    <Code>AuthorizationHeaderMalformed</Code>
    <Message>The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-1'</Message>
    <Region>us-west-1</Region>
    <RequestId>A1A1</RequestId>
    <HostId>B1B1</HostId>
</Error>

My questions:

  1. Is the region 'us-west-1' mentioned in "Region" tag the correct location of the bucket?
  2. Or is it asking us to make GET bucket location call again with new V4 signature generated using this region (us-west-1 in current example)?
  3. Can we make multiple GET bucket regions calls simultaneously for various buckets in various regions?

Edit (on Aug 25, 2016 IST): Added Que #3 above.

Edit (on Sep 08, 2016 IST): It was a buggy code for multithreading. No issue from S3. The issue is resolved. Let me know how to close the question.

1
Are you absolutely sure you are sending the request to https://s3.amazonaws.com/bucket-name?location? The s3.amazonaws.com endpoint should always require requests to be signed as us-east-1, even when you're querying for the location constraint of a bucket located elsewhere (which does work). If this is for certain what you are doing, try https://s3-external-1.amazonaws.com/bucket-name?location and see if the response differs. Also, where is the machine located that's sending the request?Michael - sqlbot
1. Yes, absolutely correct. Sending request to <s3.amazonaws.com/bucket-name?location>. 2. When we make the GET bucket region calls for various buckets sequentially, it gives correct result. Hitting the URL s3-external-1.amazonaws.com/bucket-name?‌​location suggested by you also gives the same result. 3. When we make multiple calls using multithreading, we get such errors. I hope, we can we make multiple calls simultaneously. Can you confirm?Hitesh
Yes, multiple simultaneous requests should be totally fine, but this new information suggests you could have a threading-related bug causing your code to not always send the requests where you intend. All regional endpoints have access to the bucket configuration metadata of all buckets everywhere (not the bucket content, just the config) so sending to any regional endpoint with the correct regional signature should work to get the location for any bucket. What if you send the requests to https://s3-us-west-2.amazonaws.com/bucket-name?location?Michael - sqlbot
Yep, possibly a bug in multithreading code. Because, while getting the bucket regions sequentially, we get proper bucket regions (with both the URLs: s3 and s3-external-1). While running them in multithreading, the bucket regions seems to be jumbled up. Will check for s3-us-west-2, and will let you know. @Michael-sqlbot, would you please answer for que 1 and que 2?Hitesh
It was a bug in multithreading code. Nothing related to S3.Hitesh

1 Answers

0
votes

The calls were successful when they were made in sequential order.

The error occurred only when the requests were made in parallel. It was multithreading bug in my code itself, which was not setting the values properly in the request.