Created
March 17, 2014 17:31
-
-
Save codyjlandstrom/9604167 to your computer and use it in GitHub Desktop.
S3 Bucket Policy - Only allow HTTP requests from specific referers
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
{ | |
"Version": "2012-10-17", | |
"Id": "http referer policy example", | |
"Statement": [ | |
{ | |
"Sid": "Allow get requests referred by www.mysite.com and mysite.com", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::examplebucket/*", | |
"Condition": { | |
"StringLike": { | |
"aws:Referer": [ | |
"http://www.example.com/*", | |
"http://example.com/*" | |
] | |
} | |
} | |
}, | |
{ | |
"Sid": "Explicit deny to ensure requests are allowed only from specific referer.", | |
"Effect": "Deny", | |
"Principal": "*", | |
"Action": "s3:*", | |
"Resource": "arn:aws:s3:::examplebucket/*", | |
"Condition": { | |
"StringNotLike": { | |
"aws:Referer": [ | |
"http://www.example.com/*", | |
"http://example.com/*" | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment