Created
October 4, 2011 15:06
-
-
Save DanielVF/1261888 to your computer and use it in GitHub Desktop.
Change all objects in an Amazon S3 bucket to public-read.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'aws-sdk' | |
# Change this stuff. | |
AWS.config({ | |
:access_key_id => 'YOURS_HERE', | |
:secret_access_key => 'YOURS_HERE', | |
}) | |
bucket_name = 'YOUR_BUCKET_NAME' | |
# If you have millions of objects, run this code on an EC2 instance. | |
s3 = AWS::S3.new() | |
bucket = s3.buckets[bucket_name] | |
bucket.objects.each do |object| | |
puts object.key | |
object.acl = :public_read | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment