Created
February 11, 2016 15:59
-
-
Save Soulou/1577980e612b77d9c134 to your computer and use it in GitHub Desktop.
Get signed URL with shared fs S3
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
require 'aws/s3' | |
key_id, secret, bucket = ENV["SCALINGO_SHAREDFS_CREDENTIALS"].split(":") | |
AWS::S3::Base.establish_connection!( | |
:server => 's3.myagora.fr', | |
:use_ssl => true, | |
:access_key_id => key_id, | |
:secret_access_key => secret, | |
) | |
filename = "/path/to/file" | |
signed_url = AWS::S3::S3Object.url_for( | |
filename, | |
bucket, | |
:expires_in => 60 * 60 | |
) | |
puts signed_url |
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
source 'https://rubygems.org' | |
gem 'aws-s3' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment