Skip to content

Instantly share code, notes, and snippets.

@Soulou
Created February 11, 2016 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Soulou/1577980e612b77d9c134 to your computer and use it in GitHub Desktop.
Save Soulou/1577980e612b77d9c134 to your computer and use it in GitHub Desktop.
Get signed URL with shared fs S3
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
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