Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jayankandathil/26e9ecc71fce267ff71e005569c6dfa3 to your computer and use it in GitHub Desktop.
Save jayankandathil/26e9ecc71fce267ff71e005569c6dfa3 to your computer and use it in GitHub Desktop.
Creates an Amazon S3 bucket policy that white-lists a list of IP addresses in the CIDR format
{
"Version": "2012-10-17",
"Id": "customerpoc",
"Statement": [
{
"Sid": "IPDeny",
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::bucketname",
"Condition": {
"NotIpAddress": {
"aws:SourceIp": [
"10.20.30.40/32",
"11.22.33.44/32"
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment