Created
June 24, 2014 20:50
-
-
Save drnic/663d47b6ecc0c443369b to your computer and use it in GitHub Desktop.
public buckets
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
# Paste this into a fog terminal | |
buckets = Storage[:aws].directories.map {|d| d.key} | |
buckets.each_with_index do |bucket, index| | |
policy = <<-EOS | |
{ | |
"Version": "2008-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AddPerm", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::#{bucket}/*" | |
} | |
] | |
} | |
EOS | |
Storage[:aws].put_bucket_policy(bucket, JSON.parse(policy)) | |
puts "Finished #{index + 1}/#{buckets.size}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment