Last active
April 29, 2019 22:50
-
-
Save Esl1h/346176ac380c54274b411924f6a9e8bf to your computer and use it in GitHub Desktop.
AWS S3 bucket policy example - one bucket (public, to a cloudfront distribution) and restrict permissions on some folders by username.
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", | |
"Id": "Policy1556318075116", | |
"Statement": [ | |
{ | |
"Sid": "Stmt1556317630862", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::cdn.example/videos/*" | |
}, | |
{ | |
"Sid": "Stmt1556317630862", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::cdn.example/images/*" | |
}, | |
{ | |
"Sid": "Stmt1556317630862", | |
"Effect": "Deny", | |
"Principal": "*", | |
"Action": "s3:*", | |
"Resource": [ | |
"arn:aws:s3:::cdn.example/xml/*", | |
"arn:aws:s3:::cdn.example/private/*" | |
], | |
"Condition": { | |
"ForAnyValue:StringNotEquals": { | |
"aws:username": "my-app-user" | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment