Created
May 25, 2017 02:02
-
-
Save karuna/99904116f1c3e5c3dd2801ef2ea154f4 to your computer and use it in GitHub Desktop.
S3 Bucket Policy
This file contains hidden or 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
{ | |
"Version": "2008-10-17", | |
"Id": "", | |
"Statement": [ | |
{ | |
"Sid": "Allow in my domains", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::BUCKET-NAME/*", | |
"Condition": { | |
"StringLike": { | |
"aws:Referer": [ | |
"http://www.YOUR-WEBSITE.com/*" | |
] | |
} | |
} | |
}, | |
{ | |
"Sid": "Deny access if referer is not my sites", | |
"Effect": "Deny", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::BUCKET-NAME/*", | |
"Condition": { | |
"StringNotLike": { | |
"aws:Referer": [ | |
"http://www.YOUR-WEBSITE.com/*" | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment