[Python] BOTO3 - S3 - generate_presigned_url for `put_object` returns `SignatureDoesNotMatch`

Discussão em 'Python' iniciado por Stack, Junho 25, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to create a presigned URL to upload a JSON object, but when I try to upload an object with this URL, it is denied with a SignatureDoesNotMatch error code.

    def get_put_presigned_url():
    s3_client = boto3.client('s3')
    response = s3_client.generate_presigned_url(
    ClientMethod = 'put_object',
    Params = {
    'Bucket': "my-bucket",
    'Key': "test.json",
    'ContentType': 'application/json'
    },
    ExpiresIn = 3600,
    HttpMethod = 'PUT'
    )
    return response


    If I change the method to get_object, the url works, so I am wondering if I need other settings for PUT requests. I tried adding more params like ContentType and HttMethod but it didn't change the error.

    I tried looking at other similar issues like BOTO3 - generate_presigned_url for `put_object` return `The request signature we calculated does not match the signature you provided`, but couldn't find one that fix the issue.

    Continue reading...

Compartilhe esta Página