Skip to content

Instantly share code, notes, and snippets.

@RohitRox
Created June 20, 2014 05:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RohitRox/d08e780174b596ea1720 to your computer and use it in GitHub Desktop.
Save RohitRox/d08e780174b596ea1720 to your computer and use it in GitHub Desktop.
Amazon public read bucket policy
# gem 'aws-sdk'
require 'aws-sdk'
AWS.config(:access_key_id => '', :secret_access_key => '')
policy = '{
"Id": "Policy1380877762691",
"Statement": [
{
"Sid": "Stmt1380877761162",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::inbler-prod/*",
"Principal": {
"AWS": [
"*"
]
}
}
]
}'
AWS::S3.new.buckets['bucket-name'].policy = json_policy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment