Skip to content

Instantly share code, notes, and snippets.

@prabhatsharma
Last active January 25, 2019 11:23
Show Gist options
  • Select an option

  • Save prabhatsharma/d324e43760c3e37ef049ef9ff8cf52c3 to your computer and use it in GitHub Desktop.

Select an option

Save prabhatsharma/d324e43760c3e37ef049ef9ff8cf52c3 to your computer and use it in GitHub Desktop.
s3-bucket-policy to restrict access only from certain VPCs
{
"Version": "2012-10-17",
"Id": "Policy1415115909153",
"Statement": [
{
"Sid": "Access-to-specific-VPCs-only",
"Principal": "*",
"Action": "s3:*",
"Effect": "Deny",
"Resource": [
"arn:aws:s3:::bucket-name",
"arn:aws:s3:::bucket-name/*"
],
"Condition": {
"StringNotEquals": {
"aws:sourceVpc": [
"vpc-123",
"vpc-456",
"vpc-789"
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment