feat(pipelines): support removalPolicy and autoDeleteObjects for artifact bucket#37985
Open
masamaru0513 wants to merge 1 commit into
Open
feat(pipelines): support removalPolicy and autoDeleteObjects for artifact bucket#37985masamaru0513 wants to merge 1 commit into
masamaru0513 wants to merge 1 commit into
Conversation
aws-cdk-automation
previously requested changes
May 24, 2026
…fact bucket Add `artifactBucketRemovalPolicy` and `artifactBucketAutoDeleteObjects` properties to both `PipelineProps` (aws-codepipeline L2) and `CodePipelineProps` (pipelines L3). When specified without an explicit `artifactBucket`, the managed bucket is created with the given lifecycle settings. This simplifies cleanup of dev/ephemeral pipeline stacks without requiring boilerplate bucket creation. Closes aws#36624
cb3cf2e to
ac68010
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Closes #36624.
Reason for this change
The
CodePipelineconstruct creates its artifact bucket withRemovalPolicy.RETAINby default. For dev/ephemeral environments, users must manually create a bucket with lifecycle settings — significant boilerplate for a common use case.Description of changes
Added
artifactBucketRemovalPolicyandartifactBucketAutoDeleteObjectsto both:PipelineProps(L2aws-codepipeline)CodePipelineProps(L3pipelines)The change is made at the L2 level to avoid KMS key logic duplication and construct tree path changes (as noted in #36645 review).
Validations:
artifactBucket(mutually exclusive)crossRegionReplicationBucketsautoDeleteObjects: truerequiresRemovalPolicy.DESTROYcodePipelineis provided (L3)Default behavior is unchanged —
RemovalPolicy.RETAINwhen props are not specified.How I validated
--profile staging— artifact bucket was fully cleaned up oncdk destroyChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license