Skip to content

Instantly share code, notes, and snippets.

@DanielVF
Created October 4, 2011 15:06
Show Gist options
  • Save DanielVF/1261888 to your computer and use it in GitHub Desktop.
Save DanielVF/1261888 to your computer and use it in GitHub Desktop.
Change all objects in an Amazon S3 bucket to public-read.
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