Created
February 1, 2023 17:54
-
-
Save ShivamJoker/0a308efafa8b2129c374ee311d16b480 to your computer and use it in GitHub Desktop.
Origin access control policy example to allow Amazon Cloudfront to access S3
This file contains hidden or 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": "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