Skip to content

Commit

Permalink
Allow ALBs to log to the meta bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
johnf committed Feb 26, 2025
1 parent eb078af commit a8d502b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cdk/lib/main-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ export class MainStack extends cdk.Stack {
{ id: 'AwsSolutions-S1', reason: "This bucket holds logs for other buckets and we don't want a loop" },
]);

// Allow ALBs to log
const albLogBucketPolicy = new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
principals: [new iam.ServicePrincipal('logdelivery.elasticloadbalancing.amazonaws.com')],
actions: ['s3:PutObject'],
resources: [`${this.metaBucket.bucketArn}/s3-access-logs/*`],
conditions: {
StringEquals: {
's3:x-amz-acl': 'bucket-owner-full-control',
},
},
});
this.metaBucket.addToResourcePolicy(albLogBucketPolicy);

// ////////////////////////
// Catalog bucket
// ////////////////////////
Expand Down

0 comments on commit a8d502b

Please sign in to comment.