Created
August 28, 2020 11:51
-
-
Save devops-school/94a9ef67aa197ecaa99d60e7d1144660 to your computer and use it in GitHub Desktop.
Example of S3 Bucket Policy to allow from IP address and Domain name
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
# Example of S3 Bucket Policy to allow from IP address and Domain name | |
{ | |
"Version": "2008-10-17", | |
"Id": "http referer policy example", | |
"Statement": [ | |
{ | |
"Sid": "Allow get requests originated from www.example.com and example.com", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::324324234324/*", | |
"Condition": { | |
"StringLike": { | |
"aws:Referer": [ | |
"https://www.devopsschool.com/*", | |
"https://devopsschool.com/*", | |
"https://devopsschool.com*", | |
"https://devopsschool.com" | |
] | |
} | |
} | |
}, | |
{ | |
"Sid": "Allow get requests originated from www.example.com and example.com", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::43223423432/*", | |
"Condition": { | |
"IpAddress": { | |
"aws:SourceIp": ["132.148.28.44/30","10.193.44.89/30"] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment