Skip to content

Instantly share code, notes, and snippets.

@j1n6
Created November 26, 2014 11:39
Show Gist options
  • Save j1n6/514950a7ccdd0a678273 to your computer and use it in GitHub Desktop.
Save j1n6/514950a7ccdd0a678273 to your computer and use it in GitHub Desktop.
Allow a single IP to access S3 Bucket

Only allow specific IP address to access this bucket via API or HTTP.

{
	"Version": "2008-10-17",
	"Id": "S3PolicyId1",
	"Statement": [
		{
			"Sid": "IPDeny",
			"Effect": "Deny",
			"Principal": {
				"AWS": "*"
			},
			"Action": "s3:*",
			"Resource": "arn:aws:s3:::mybucketname/*",
			"Condition": {
				"NotIpAddress": {
					"aws:SourceIp": "xxx.xxx.xxx.xxx/32"
				}
			}
		}
	]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment