Skip to content

Commit

Permalink
fix: ACLs must be allowed for cloudfront log bucket
Browse files Browse the repository at this point in the history
In https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html
it's described how since april 2023, new bucket are created with ACLs
disabled. Cloudfront still requires them, so it needs to be set.

In aws/aws-cdk#25358, specifically under
'Using an S3 Bucket for CloudFront logs' there's a solution posted. This
implements that option, to prevent the cloudformation error:
""Invalid request provided: AWS::CloudFront::Distribution: The S3 bucket
that you specified for CloudFront logs does not enable ACL access"
  • Loading branch information
joostvanderborg committed May 8, 2023
1 parent cdc4416 commit c1659bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CloudfrontStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { RemoteParameters } from 'cdk-remote-stack';
import { Construct } from 'constructs';
import { Statics } from './statics';


export class CloudfrontStack extends Stack {
private zone?: IHostedZone;
constructor(scope: Construct, id: string) {
Expand Down Expand Up @@ -189,6 +188,7 @@ export class CloudfrontStack extends Stack {
eventBridgeEnabled: true,
enforceSSL: true,
encryption: S3.BucketEncryption.S3_MANAGED,
objectOwnership: S3.ObjectOwnership.OBJECT_WRITER,
lifecycleRules: [
{
id: 'delete objects after 180 days',
Expand Down Expand Up @@ -297,4 +297,4 @@ export class CloudfrontStack extends Stack {
distributionPaths: ['/static/*'],
});
}
}
}

0 comments on commit c1659bb

Please sign in to comment.