Skip to content

fix(template.yaml): enable ACLs on cloudfront logging bucket and add bucket policy #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,31 @@ Resources:
## CloudFront access logs storage
CloudFrontAccessLogsBucket:
Type: AWS::S3::Bucket
Properties:
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerPreferred
AccessControl: LogDeliveryWrite

CloudFrontAccessLogsBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref CloudFrontAccessLogsBucket
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: cloudfront.amazonaws.com
Action: s3:PutObject
Resource: !Sub "${CloudFrontAccessLogsBucket.Arn}/*"
- Effect: Allow
Principal:
Service: cloudfront.amazonaws.com
Action:
- s3:GetBucketAcl
- s3:PutBucketAcl
Resource: !GetAtt CloudFrontAccessLogsBucket.Arn

## Amplify Application for hosting
AmplifyApp:
Expand Down