Skip to content

Commit 579041e

Browse files
authored
feat(bootstrap): delete noncurrent versions after 30 days (#31949)
CDK assets in the bootstrap bucket are content-addressed and immutable so we never naturally create noncurrent versions. However, with the introduction of the `cdk gc` command, we now have the capacity to delete unused objects in the bucket. Because the bucket is versioned by default, the delete command [actually](https://docs.aws.amazon.com/AmazonS3/latest/userguide/DeletingObjectVersions.html) just replaces the object with a new dummy version (thus the deleted object becomes noncurrent). Now that noncurrent objects _can_ happen, if one utilizes `cdk gc`, we are updating the bootstrap template to retain them for 30 days rather than 365 days. Update to bootstrap version 24 to use this new lifecycle policy in conjunction with `cdk gc`. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 3818234 commit 579041e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/aws-cdk/lib/api/bootstrap/bootstrap-template.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ Resources:
207207
Status: Enabled
208208
LifecycleConfiguration:
209209
Rules:
210-
# Exising objects will never be overwritten but Security Hub wants this rule to exist
210+
# Objects will only be noncurrent if they are deleted via garbage collection.
211211
- Id: CleanupOldVersions
212212
Status: Enabled
213213
NoncurrentVersionExpiration:
214-
NoncurrentDays: 365
214+
NoncurrentDays: 30
215215
UpdateReplacePolicy: Retain
216216
DeletionPolicy: Retain
217217
StagingBucketPolicy:
@@ -653,7 +653,7 @@ Resources:
653653
Type: String
654654
Name:
655655
Fn::Sub: '/cdk-bootstrap/${Qualifier}/version'
656-
Value: '23'
656+
Value: '24'
657657
Outputs:
658658
BucketName:
659659
Description: The name of the S3 bucket owned by the CDK toolkit stack

0 commit comments

Comments
 (0)