Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 21st, 2012  |  syntax: None  |  size: 0.38 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require 'rubygems'
  2. require 'aws-sdk'
  3.  
  4.  
  5. # Change this stuff.
  6. AWS.config({
  7.     :access_key_id => 'YOURS_HERE',
  8.     :secret_access_key => 'YOURS_HERE',
  9. })
  10. bucket_name = 'YOUR_BUCKET_NAME'
  11.  
  12.  
  13. # If you have millions of objects, run this code on an EC2 instance.
  14. s3 = AWS::S3.new()
  15. bucket = s3.buckets[bucket_name]
  16. bucket.objects.each do |object|
  17.     puts object.key
  18.     object.acl = :public_read
  19. end