Kirill Salykin
Kirill Salykin

Reputation: 711

amazon s3 upload signed url public-read

This is the URL generated by the Ruby aws-sdk gem for put:

curl --upload-file "/Users/README.rdoc" 
-H "x-amz-acl=public-read" 
"http://videos.s3.amazonaws.com/6c06517c-64f1-45ed-b07f-8c4c4edec6e3?AWSAccessKeyId={key}&Expires=1384519899&Signature=MKtBESBklYXFT%2B48EKLSoBiQpNA%3D"

-H "x-amz-acl=public-read" is not present in the signature. The signature is OK (Amazon doesn't show any errors).

But the "public-read" permission is not applied, please advise me as to how I can generate a put signed URL which will be public-read after upload.

Thanks!

Updated:

s3 = AWS::S3.new
bucket = s3.buckets['some_videos']
id = SecureRandom.uuid
object = bucket.objects["#{id}"]
url = object.url_for(:put, expires_in: 30*60)

Upvotes: 4

Views: 3183

Answers (2)

Mike H-R
Mike H-R

Reputation: 7815

it looks like you can specify this with the acl method (documented here) If you want to set your bucket to public read you can call:

s3.buckets['some-videos'].acl = :public_read

if you would like to apply this permission directly to an object you can call:

bucket.objects["#{id}"].acl= :public_read

Upvotes: 3

Related Questions