Skip to content

Instantly share code, notes, and snippets.

@abevoelker
Created March 31, 2014 01:20
Show Gist options
  • Save abevoelker/9883319 to your computer and use it in GitHub Desktop.
Save abevoelker/9883319 to your computer and use it in GitHub Desktop.
S3 bucket policy to whitelist access to CloudFlare (IPv6 addresses don't seem to be supported in bucket policies)
{
"Id": "Policy1234",
"Statement": [
{
"Sid": "Stmt1234",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::foo/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"199.27.128.0/21",
"173.245.48.0/20",
"103.21.244.0/22",
"103.22.200.0/22",
"103.31.4.0/22",
"141.101.64.0/18",
"108.162.192.0/18",
"190.93.240.0/20",
"188.114.96.0/20",
"197.234.240.0/22",
"198.41.128.0/17",
"162.158.0.0/15",
"104.16.0.0/12"
]
}
},
"Principal": {
"AWS": [
"*"
]
}
}
]
}
@abevoelker
Copy link
Author

Created an AWS forum thread noting that IPv6 addresses are broken: https://forums.aws.amazon.com/thread.jspa?threadID=149144

@ZE3kr
Copy link

ZE3kr commented May 21, 2016

I updated the IPv4 range of CloudFlare here https://gist.github.com/ZE3kr/0f26ae62f1590338a3f1f0127289f7d6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment