How to get authenticated_read URL to arbitrary file on S3 using CW?

35 views
Skip to first unread message

Alexander Hanhikoski

unread,
May 8, 2011, 3:58:34 PM5/8/11
to carrierwave
Given the credentials, bucket and path to the file ("uploads/
foo.zip").. how would one generate an authenticated URL to that file?

Alexander Hanhikoski

unread,
May 8, 2011, 4:55:26 PM5/8/11
to carrierwave
Turns out this was trivial with Fog:

s3 = Fog::Storage.new(:provider => 'AWS',
:aws_access_key_id => 'xxx',
:aws_secret_access_key => 'xxx',
:region => 'eu-west-1'
)

s3.get_object_url('bucket_name', 'uploads/foo.zip', Time.now +
10.minutes)

On May 8, 10:58 pm, Alexander Hanhikoski
Reply all
Reply to author
Forward
0 new messages