Skip to content

Instantly share code, notes, and snippets.

@rwalk
Created June 8, 2020 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwalk/b1a397188e409a159dcf99d33f1573d6 to your computer and use it in GitHub Desktop.
Save rwalk/b1a397188e409a159dcf99d33f1573d6 to your computer and use it in GitHub Desktop.
AWS permit users read/list access to a prefix in a bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::fancy-bucket"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"fancy-prefix/*"
]
}
}
},
{
"Effect": "Allow",
"Action": [
"s3:Get*"
],
"Resource": "arn:aws:s3:::fancy-bucket/fancy-prefix/*"
}
]
}
@rwalk
Copy link
Author

rwalk commented Jun 8, 2020

I often need to provide a user access to a single prefix path in S3. And I always forget how to do it. Here is a policy that does this. Attach it to the IAM user who needs this access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment