Skip to content

Instantly share code, notes, and snippets.

@coingraham
Created June 28, 2018 15:19
Show Gist options
  • Select an option

  • Save coingraham/ecc9dff68946d47b752f02af15e85d7b to your computer and use it in GitHub Desktop.

Select an option

Save coingraham/ecc9dff68946d47b752f02af15e85d7b to your computer and use it in GitHub Desktop.
Get a Presigned URL
import boto3
profile = "myprofile"
region = "us-east-1"
expiration = 36000 # one hour in seconds
bucket = "mybucket"
key = "myobjectkey"
session = boto3.session.Session(profile_name=profile, region_name=region)
params = {
"Bucket": bucket,
"Key": key
}
s3 = session.client('s3')
print(s3.generate_presigned_url('get_object', Params=params, ExpiresIn=expiration))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment