Skip to content

Instantly share code, notes, and snippets.

@joshdholtz
Last active December 11, 2015 14:18
Show Gist options
  • Save joshdholtz/4612927 to your computer and use it in GitHub Desktop.
Save joshdholtz/4612927 to your computer and use it in GitHub Desktop.
Sinatra - redirecting a user to a file stored in S3 with an authenticated url that expires in 5 minutes
get "/:filename" do
AWS::S3::Base.establish_connection!(
:access_key_id => ENV['S3_KEY'],
:secret_access_key => ENV['S3_SECRET'])
redirect AWS::S3::S3Object.url_for(params[:filename], ENV['S3_BUCKET'])
end
@CloudMarc
Copy link

nice - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment