Saltar al contenido

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.

preguntada hace 2 años661 visualizaciones
2 Respuestas
3
Respuesta aceptada

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")
EXPERTO
respondido hace 2 años
EXPERTO
revisado hace 2 años
EXPERTO
revisado hace 2 años
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?

EXPERTO
respondido hace 2 años
EXPERTO
revisado hace 2 años
  • Thank you for help. I saw this resource early and have already checked the solutions that suggested there. Nothing helped me.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.