跳至内容

S3 Presigned URL doesn't work from newly created buckets

0

Problem description (Python 3.12):

13-Sept: Created a new "bucket_1" (AWS console), added a new "file_1" (AWS console), created a presigned URL to get the "file_1" from "bucket_1" (AWS boto3). Link doesn't work. Error: <Code>SignatureDoesNotMatch</Code> <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message> ..........

14-Sept: Created a new presigned URL for the old (yesterday's) "file_1" from the old (yesterday's) "bucket_1" (AWS boto3). Link works fine (the same code, same IAM user, same computer).

14-Sept: Created a new "bucket_2", added a new "file_2", created a presigned URL to get the "file_2" from "bucket_2" (AWS boto3). Link doesn't work. Error the same (SignatureDoesNotMatch).

14-Sept: The old "file_1" added to the new "bucket_2" (AWS console), created a presigned URL for the "file_1" from "bucket_2" (AWS boto3). Link doesn't work. Error the same (SignatureDoesNotMatch).

Were checked:

  • credentials (the same account)
  • permissions (IAM user has "Administrator access")
  • naming of the buckets and files are unchanged
  • region of the bucket and bucket creator are the same
  • signing method (by default it is "SigV4" in boto3)
  • using AWS CLI gives the same result
  • BUT: directly creating presigned url in the AWS console always works fine

I can't imagine where to look. Any help would be appreciated.

已提问 2 年前663 查看次数
2 回答
3
已接受的回答

Hello.

What code are you using to issue Presigned URLs?
I answered a similar problem a while ago, but at that time I was able to resolve it by specifying "endpoint_url" when creating the S3 client.
https://repost.aws/questions/QUxFKBL7VwSomPT1thHt6qLg/pre-signed-url-timezone-put#ANuoLZPqTsRv-qu4eWLc67-A

s3_client = boto3.client('s3',region_name="eu-central-1",endpoint_url="https://s3.eu-central-1.amazonaws.com")
专家
已回答 2 年前
专家
已审核 2 年前
专家
已审核 2 年前
1

It may be that you fell into a specific case of limits within the presigned URLs of S3 as specified in https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html#PresignedUrlUploadObject-LimitCapabilities

Can we look at the code you use so we can spot anything in there?

专家
已回答 2 年前
专家
已审核 2 年前
  • Thank you for help. I saw this resource early and have already checked the solutions that suggested there. Nothing helped me.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。