Reputation: 12814
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.
Upvotes: 3
Views: 2047
Reputation: 661
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
Upvotes: 0
Reputation: 714
RightAws::S3::Grantee.new(key, "http://acs.amazonaws.com/groups/global/AllUsers", ["READ"], :apply, "AllUsers") works for me.
Upvotes: 1
Reputation: 5899
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.
Upvotes: 1