I have setup a CloudFront distribution.
On the S3 bucket I have set Block all public access
to OFF
.
The bucket policy looks like this:
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E*********3"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<bucket name.....>/*"
}
]
}
The CloudFront distribution origin is associated with the OAI specified in the bucket principal like shown above. To my understanding the bucket policy above should allow the CloudFront distribution to access the file since the origin is specified in CloudFront and its OAI matches the one shown in the bucket policy.
I'm thinking I need to modify the policy of the files in the bucket?
My goal is to only have CloudFront be able to read the file in the bucket and lock it down otherwise.
What do I need to change to achieve that?