Skip to content Skip to sidebar Skip to footer

Get Url Of Public Accessible S3 Object Using Boto3 Without Expiration Or Security Info

Running a line like: s3_obj = boto3.resource('s3').Object(bucket, key) s3_obj.meta.client.generate_presigned_url('get_object', ExpiresIn=0, Params={'Bucket':bucket,'Key':key}) Yie

Solution 1:

The best solution I found is still to use the generate_presigned_url, just that the Client.Config.signature_version needs to be set to botocore.UNSIGNED.

The following returns the public link without the signing stuff.

config.signature_version = botocore.UNSIGNED
boto3.client('s3', config=config).generate_presigned_url('get_object', ExpiresIn=0, Params={'Bucket': bucket, 'Key': key})

The relevant discussions on the boto3 repository are:

Post a Comment for "Get Url Of Public Accessible S3 Object Using Boto3 Without Expiration Or Security Info"