Skip to content

Instantly share code, notes, and snippets.

@AmarPrabhu
Forked from alicial/amz-s3-bucket-policy
Created July 25, 2013 09:43
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 AmarPrabhu/6078309 to your computer and use it in GitHub Desktop.
Save AmarPrabhu/6078309 to your computer and use it in GitHub Desktop.
{
"Version": "2008-10-17",
"Id": "0c762de8-f56b-488d-a4a4-20d1cb31df2f",
"Statement": [
{
"Sid": "Allow in my domains",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<Bucket Name>/*",
"Condition": {
"StringLike": {
"aws:Referer": ["http://<allowed referrer site(s)>/*", "http://www.<allowed referrer site(s)>/*"]
}
}
},
{
"Sid": "Give not access if referer is no my sites",
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<Bucket Name>/*",
"Condition": {
"StringNotLike": {
"aws:Referer": ["http://<allowed referrer site(s)>/*", "http://www.<allowed referrer site(s)>/*"]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment