Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ap-east-1 location constraint is incompatible for the region specific endpoint this request was sent to #2098

Closed
venu6644 opened this issue Aug 27, 2019 · 3 comments
Assignees
Labels

Comments

@venu6644
Copy link

I have a lambda script which check if default encryption is enabled or not. then it enables it if its not present. But I get the below error. Can someone help.Thanks.

[
  "/var/task/s3_enable_default_encryption_lambda.py",
  49,
  "put_default_encryption",
  "'SSEAlgorithm': 'AES256',"
],
[
  "/var/runtime/botocore/client.py",
  314,
  "_api_call",
  "return self._make_api_call(operation_name, kwargs)"
],
[
  "/var/runtime/botocore/client.py",
  612,
  "_make_api_call",
  "raise error_class(parsed_response, operation_name)"
]

]
}

@swetashre swetashre self-assigned this Aug 27, 2019
@swetashre
Copy link
Contributor

@venu6644 - Thank you for your post. This happens when your configured default region is different than the region specified during client creation.

If a request arrives at the wrong Amazon S3 location, Amazon S3 responds with a temporary redirect that tells the requester to resend the request to a new endpoint. If a request is incorrectly formed, Amazon S3 uses permanent redirects to provide direction on how to perform the request correctly. Here is the link which demonstrates how s3 redirect behavior works:
https://docs.aws.amazon.com/AmazonS3/latest/dev/Redirects.html

I think the same redirect behavior is not working for ap-east-1 region but in any case i need some more information to understand the root issue:

  1. Can you please give me the code sample you are using ?
  2. What is your default region set to ?
  3. The Bucket, you are using for put_bucket_encryption is in which region ?

It would be very helpful if you can give me the debug log. You can enable the log by adding boto3.set_stream_logger('') to your code.

@swetashre swetashre added response-requested Waiting on additional information or feedback. s3 labels Aug 27, 2019
@swetashre swetashre added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Aug 28, 2019
@venu6644
Copy link
Author

venu6644 commented Aug 29, 2019

Was able to figure out a way by adding location
client = boto3.client('s3',region_name=location) .
Thanks for your help

@no-response no-response bot removed the closing-soon This issue will automatically close in 4 days unless further comments are made. label Aug 29, 2019
@swetashre
Copy link
Contributor

@venu6644 - I am glad you got it working. I am closing the issue as this issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants