Skip to content

Instantly share code, notes, and snippets.

@thukim
Created August 11, 2014 09:20
Show Gist options
  • Save thukim/4fd58e06f7e541ca2ded to your computer and use it in GitHub Desktop.
Save thukim/4fd58e06f7e541ca2ded to your computer and use it in GitHub Desktop.
namespace :aws do
task :set_bucket_objects_permission do
AWS.config(access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], region: 'ap-southeast-1', :s3 => { :region => 'ap-southeast-1' })
bucket = AWS::S3.new.buckets[ENV['S3_BUCKET_NAME']]
if bucket.exists?
bucket.objects.each do |object|
puts object.key
object.acl = :public_read
puts object.public_url
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment