S3 bucket policy to allow CloudFront logging

0

Hi,

I have two S3 buckets, and one of them has a website. Thanks fort he help, Route 53, CloudFront, and S3 are all working well to serve the website now.

I have also enabled CloudFront standard logging and selected an S3 bucket for log data.

Is there an example policy I can apply to the logging S3 permission?

I found this but I get 'Invalid principal in policy' error: https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html#example-bucket-policies-cloudfront

{
    "Version": "2012-10-17",
    "Id": "PolicyForCloudFrontPrivateContent",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E27xxxx"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*"
        }
    ]
}

Also, are there any disadvantages to turning on Cookie Logging?

Thanks!

profile picture
newbie
已提問 2 年前檢視次數 3523 次
2 個答案
1
已接受的答案

I would refer this doc for the error and make sure the Syntax and steps are accurate.

Link- https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html#example-bucket-policies-cloudfront

Regarding Cookie Logging, The Cookie header in the request, including name—value pairs and the associated attributes.

If you enable cookie logging, CloudFront logs the cookies in all requests regardless of which cookies you choose to forward to the origin. When a request doesn’t include a cookie header, this field’s value is a hyphen (-). Refer https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Cookies.html to check for more use-cases and features.

profile pictureAWS
支援工程師
已回答 2 年前
profile pictureAWS
專家
Toni_S
已審閱 2 年前
0

Thank you!

profile picture
newbie
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南