开发者

How to change file permission of all files in a S3 bucket using either aws-s3 gem or right_aws gem

开发者 https://www.devze.com 2023-01-11 03:02 出处:网络
Is there a way to change the permission of every single file in a S3 bucket using either aws-s3 gem or right_aws gem?

Is there a way to change the permission of every single file in a S3 bucket using either aws-s3 gem or right_aws gem?

I can't find it in the doc开发者_JAVA技巧umentation. Do I have to do each file individually?

I would like to grant "everyone" view permission.


I do not believe these gems are supposed to set permissions, that might be the reason you do not find this feature in the docs. Set your permissions in AWS console or through their API, amazon also has command line tools for setting S3 permissions.

The gem aws-s3 (and probably right_aws as well) is for reading and storing files in S3 from ruby. Setting permissions is a bit different discipline.


RightAws::S3::Grantee.new(key, "http://acs.amazonaws.com/groups/global/AllUsers", ["READ"], :apply, "AllUsers") works for me.


According to the docs, the gem provides an acl= method for S3Object. You can pretty easily iterate through each object in the bucket and programmatically set the acl on each object.

http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/S3Object.html#acl%3D-instance_method

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号