by

Amazon S3 Aws - Generate signed object download URLs

This python code generates signed URL to download a private file from Amazon S3 storage, invoking boto API.
Note that this generates a signed download URL for secret_plans.txt that will work for 1 hour (3600 seconds). 
Signed download URLs will work for the time period even if the object is private (when the time period is up, the URL will stop working).
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/5890/Amazon-S3-Aws---Generate-signed-object-d?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
# Get the private key reference to secret_plans.txt file plans_key = bucket.get_key('secret_plans.txt') # Generate a signed URL, timer is set to 1 hour plans_url = plans_key.generate_url(3600, query_auth=True, force_http=True) print plans_url

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus