Skip to content

Instantly share code, notes, and snippets.

@uurtech
Last active April 30, 2025 09:14
Show Gist options
  • Save uurtech/ee4020c4ebddf1e07a02a7d50462528e to your computer and use it in GitHub Desktop.
Save uurtech/ee4020c4ebddf1e07a02a7d50462528e to your computer and use it in GitHub Desktop.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowCloudFrontOACAccessToAllObjects",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/*",
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::<account-id>:distribution/<distribution-id>"
}
}
},
{
"Sid": "ExplicitDenyForSpecificFolder",
"Effect": "Deny",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/private/*",
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::<account-id>:distribution/<distribution-id>"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment