Recent created bucket doesn't support sigv4 presigned url

0

I create a new bucket gantry-image-mvp-demo today and try to generate presigned url for objects stored in that bucket. The presigned url with sigv2 works but if I generate a presigned url using sigv4 I will get SignatureDoesNotMatch error when I try to access the object.

here is how I generate the presigned url:

def generate_presigned_url(use_sigv4=True):
    session = boto3.Session(profile_name='myprofile')
    if use_sigv4:
        client = session.client('s3', region_name="us-west-2",config=Config(signature_version='s3v4')) # this one will fail
    else:
        client = session.client('s3', region_name="us-west-2") # this one will work

    # Generate the URL to get 'key-name' from 'bucket-name'
    url = client.generate_presigned_url(
        ClientMethod='get_object',
        Params={
            'Bucket': 'gantry-image-mvp-demo',
            'Key': 'imagenet_sample/n01531178_goldfinch.JPEG'
        }
    )
    return url

To make is clear I have another bucket gantry-customer-bucket-access-test-pdx I created two days ago and I can generate valid presign url using both sigv2 and sigv4. Want to understand what has been changed.

asked 2 years ago305 views
1 Answer
0

I'm seeing the same, I've asked a Q at S/O but at this point I assume this is a known but undocumented bug in S3 https://stackoverflow.com/questions/75056881/presigned-url-uploads-to-new-s3-buckets-will-fail-eg-10054-on-windows

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions