Skip to content
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

feat(s3): add autoDeleteObjectsLogGroup to pass log group to custom resource lambda #30333

Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
s3.Bucket: update README to include
  • Loading branch information
samson-keung committed May 24, 2024
commit d296fb32021c9579a2ea2cc818db4cbd8fda9f51
6 changes: 6 additions & 0 deletions packages/aws-cdk-lib/aws-s3/README.md
Original file line number Diff line number Diff line change
@@ -624,10 +624,16 @@ enable the`autoDeleteObjects` option.

When `autoDeleteObjects` is enabled, `s3:PutBucketPolicy` is added to the bucket policy. This is done to allow the custom resource this feature is built on to add a deny policy for `s3:PutObject` to the bucket policy when a delete stack event occurs. Adding this deny policy prevents new objects from being written to the bucket. Doing this prevents race conditions with external bucket writers during the deletion process.

Pass a custom log group via the `autoDeleteObjectsLogGroup` option, which will be used by the custom resource lambda.

```ts
const bucket = new s3.Bucket(this, 'MyTempFileBucket', {
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true,
autoDeleteObjectsLogGroup: new LogGroup(stack, 'LogGroup', {
logGroupName: 'MyLogGroup',
retention: RetentionDays.TWO_YEARS
})
});
```

Loading