简体   繁体   中英

How to change file permission of all files 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 documentation. 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(密钥,“http://acs.amazonaws.com/groups/global/AllUsers”,[“READ”],:apply,“AllUsers”)适合我。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM