Created
June 21, 2019 15:56
-
-
Save tonyfraser/d57c158fc2614018909899e5e0255632 to your computer and use it in GitHub Desktop.
a full access policy, designed to assign a subdirectory/subkey to a policy. Think s3://bucket/environmet/dev, only assigning dev to this policy.
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": [ | |
{ | |
"Action": [ | |
"s3:ListAllMyBuckets", | |
"s3:GetBucketLocation" | |
], | |
"Effect": "Allow", | |
"Resource": [ | |
"arn:aws:s3:::*" | |
] | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": "s3:ListBucket", | |
"Resource": "arn:aws:s3:::{bucket}", | |
"Condition": { | |
"StringLike": { | |
"s3:prefix": [ | |
"", | |
"{key}", | |
"{key}/*", | |
"{key}/{subkey}", | |
"{key}/{subkey}/*" | |
] | |
} | |
} | |
}, | |
{ | |
"Action": [ | |
"s3:*" | |
], | |
"Effect": "Allow", | |
"Resource": [ | |
"arn:aws:s3:::{bucket}/{key}/{subkey}", | |
"arn:aws:s3:::{bucket}/{key}/{subkey}/*" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment