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.

질문됨 2년 전315회 조회
1개 답변
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

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인