Created
March 24, 2022 17:34
-
-
Save devhops/74bd4269ed56d7acfd66bfccc9d4f1bb to your computer and use it in GitHub Desktop.
Allow access to one subfolder in a bucket, but not to list all buckets or the contents of the root folder
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": "AllowAccess", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:PutObject", | |
"s3:GetObject", | |
"s3:ListBucketMultipartUploads", | |
"s3:AbortMultipartUpload", | |
"s3:ListBucket", | |
"s3:DeleteObject", | |
"s3:GetObjectVersion", | |
"s3:ListMultipartUploadParts" | |
], | |
"Resource": [ | |
"arn:aws:s3:::BucketName", | |
"arn:aws:s3:::BucketName/FolderName/*" | |
] | |
}, | |
{ | |
"Sid": "DenyAccess", | |
"Effect": "Deny", | |
"Action": "s3:ListBucket", | |
"Resource": "arn:aws:s3:::BucketName", | |
"Condition": { | |
"ForAllValues:StringNotEquals": { | |
"s3:prefix": [ | |
"FolderName", | |
"FolderName/", | |
"FolderName/*" | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment