I\'ve been using this forever with paperclip and aws-s3:
def authenticated_url(style = nil, expires_in = 90.minutes)
AWS::S3::S3Object.url_for(attach
Recently I upgraded to the newest gem for AWS SDK 2 for Ruby (aws-sdk-2.1.13) and getting pre-signed url has changed in this SDK version.
The way of getting it:
presigner = Aws::S3::Presigner.new
presigner.presigned_url(:get_object, #method
bucket: 'bucket-name', #name of the bucket
key: "key-name", #key name
expires_in: 7.days.to_i #time should be in seconds
).to_s
You can find more info here: http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Presigner.html