Skip to content

Instantly share code, notes, and snippets.

@drnic
Created June 24, 2014 20:50
Show Gist options
  • Save drnic/663d47b6ecc0c443369b to your computer and use it in GitHub Desktop.
Save drnic/663d47b6ecc0c443369b to your computer and use it in GitHub Desktop.
public buckets
# 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