3

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)
4

2 回答 2

2

看起来您可以使用 acl 方法指定它(在此处记录)如果您想将存储桶设置为公开读取,您可以调用:

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

如果您想将此权限直接应用于可以调用的对象:

bucket.objects["#{id}"].acl= :public_read
于 2013-11-20T03:18:51.867 回答
1

亚马逊团队将此添加到他们的 sdk 中。多谢你们! https://github.com/aws/aws-sdk-ruby/issues/412 https://github.com/aws/aws-sdk-ruby/commit/15e900c0918a67e20bbb6dd9509c112aa01a95ee

于 2013-11-21T20:11:38.000 回答