Skip to content

Instantly share code, notes, and snippets.

@ShivamJoker
Created February 1, 2023 17:54
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 ShivamJoker/0a308efafa8b2129c374ee311d16b480 to your computer and use it in GitHub Desktop.
Save ShivamJoker/0a308efafa8b2129c374ee311d16b480 to your computer and use it in GitHub Desktop.
Origin access control policy example to allow Amazon Cloudfront to access S3
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "AllowCloudFrontServicePrincipal",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/*",
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::your-cloudfront-arn"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment