Skip to content

Instantly share code, notes, and snippets.

@actionjack
Forked from mrsarm/AWSBucketPolicy.json
Last active November 4, 2018 12:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save actionjack/d900c6587297f24d83b14c2b7a85200f to your computer and use it in GitHub Desktop.
Save actionjack/d900c6587297f24d83b14c2b7a85200f to your computer and use it in GitHub Desktop.
AWS Bucket Policy to deny access to all except NotPrincipal list
{
"Version": "2012-10-17",
"Id": "Policy9999999990001",
"Statement": [
{
"Sid": "Deny access except NotPrincipal list",
"Effect": "Deny",
"NotPrincipal": {
"AWS": [
"arn:aws:iam::123000004567:role/xxxx-eb-ec2-role",
"arn:aws:iam::123000004567:user/Marianoruiz",
"arn:aws:iam::123000004567:user/pepe2222"
]
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::bucket-name"
}
]
}
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"AllowPublicUpload",
"Effect":"Allow",
"Principal": {
"AWS": "*"
},
"Action":["s3:PutObject","s3:PutObjectAcl"],
"Resource":["arn:aws:s3:::bucket-name/*"]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment