Created
July 14, 2023 01:17
-
-
Save eswarijayakumar/0e29f843fd1ff722128931c6fb198a73 to your computer and use it in GitHub Desktop.
Python code to Generate Presigned URL for accessing S3 bucket files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
session = boto3.Session( | |
aws_access_key_id="<Provide your AWS access Key ID>", | |
aws_secret_access_key="<Provide your AWS Secret Key>", | |
region_name="us-east-1" | |
) | |
s3_client = session.client('s3') | |
url = s3_client.generate_presigned_url( | |
ClientMethod="get_object", | |
Params={ | |
'Bucket': 'demobucket', | |
'Key': 'test-cover.png' | |
}, | |
ExpiresIn=1800 | |
) | |
print(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment