S3 generate_presigned_post problem with Multi Region Access Point #3529
Replies: 3 comments
-
Hi @hoonki-kim, thanks for reaching out. I had some trouble reproducing this behavior; could you provide debug logs (with sensitive info redacted) and maybe more information about your POST API call? You can get debug logs by adding |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
-
Hello @hoonki-kim, I had similar, but different issues. Disclaimer though, I am no expert on boto or S3.
Example: import boto3
# It seems you must configure the s3 boto client to use v4 signatures
# if you intend to upload via the Access Point alias (which we will)
s3_client = boto3.client("s3", config=Config(signature_version="v4"))
# we will create the pre-signed post using the original Bucket name (not Access Point arn/alias)
bucket_name = "myawsbucket"
upload_details = s3_client.generate_presigned_post(Bucket=bucket_name, Key="test.txt", ExpiresIn=30)
# Create the url we will use to upload from the Access Point alias
my_mrap = "abcdefghijklm.mrap"
access_point_url = f"https://{my_mrap}.accesspoint.s3-global.amazonaws.com/"
with open('./test.txt', 'rb') as file_to_upload:
files = {'file': ('./test.txt', file_to_upload)}
upload_response = requests.post(access_point_url, data=upload_details['fields'], files=files)
print(upload_response.status_code, upload_response.content) Like you, I also tried using the Access Point ARN initially, but since mine was a regular Access Point and not a multi-region one I couldn't even call |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I tried to generate a presigned post url using a Multi Region Access Point like this and received a success response.
but using response data, post api call failed with this response.
i tried add conditions like this, but all failed.
i think in
botocore
signers.py
code this point , it seems that the bucket name passed to mrap arn has a fixed effect on the policy.Can you give me some solution?
Same Problem In Stack Overflow Thread Not Solved : https://stackoverflow.com/questions/71415180/how-to-use-sdk-generated-presigned-s3-urls-with-multi-region-access-points
Beta Was this translation helpful? Give feedback.
All reactions