Last active
December 10, 2017 00:46
-
-
Save pacohope/c9c61cde3ea2aaab31acd42b5cb1a4cb to your computer and use it in GitHub Desktop.
S3 bucket restriction. Enable get/put on one bucket, but deny explicitly everything else
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowAllBasics", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:ListAllMyBuckets", | |
"s3:HeadBucket", | |
"s3:ListObjects" | |
], | |
"Resource": "arn:aws:s3:::*" | |
}, | |
{ | |
"Sid": "AllowListBuckets", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:ListBuckets", | |
"s3:GetBucketLocation" | |
], | |
"Resource": "arn:aws:s3:::BUCKET_NAME" | |
}, | |
{ | |
"Sid": "AllowGetPutObjects", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:GetObject", | |
"s3:PutObject" | |
], | |
"Resource": "arn:aws:s3:::BUCKET_NAME/*" | |
}, | |
{ | |
"Sid": "DenyOtherBuckets", | |
"Effect": "Deny", | |
"Action": [ | |
"s3:Put*", | |
"s3:Delete*" | |
], | |
"NotResource": "arn:aws:s3:::BUCKET_NAME/*" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment