Skip to content

Instantly share code, notes, and snippets.

@KazChe
Created September 4, 2018 23:05
Show Gist options
  • Save KazChe/df66338db792ebe12aba5e8349201f48 to your computer and use it in GitHub Desktop.
Save KazChe/df66338db792ebe12aba5e8349201f48 to your computer and use it in GitHub Desktop.
AWS S3 bucket policy allowing only certain IP addresses to GET from it.
{
"Version": "2008-10-17",
"Id": "S3PolicyId1",
"Statement": [
{
"Sid": "IPAllow",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<ADD_YOUR_BUCKET_NAME_HERE>/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"<ADD_IP_ADDRESS_HERE>/32",
"<ADD_IP_ADDRESS_HERE>/32"
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment