Direkt zum Inhalt

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.

gefragt vor 2 Jahren661 Aufrufe
2 Antworten
3
Akzeptierte Antwort

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")
EXPERTE
beantwortet vor 2 Jahren
EXPERTE
überprüft vor 2 Jahren
EXPERTE
überprüft vor 2 Jahren
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?

EXPERTE
beantwortet vor 2 Jahren
EXPERTE
überprüft vor 2 Jahren
  • Thank you for help. I saw this resource early and have already checked the solutions that suggested there. Nothing helped me.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.