Reputation: 31
In CDK while creating pipeline it create new buckets for artifacts. Is there any way to use pre-existing bucket for every pipeline ?
Upvotes: 1
Views: 835
Reputation: 496
I recently came across the same issue and split my CDK application into multiple stacks. There is an example AWS provides but it probably is a bit overkill what they do with the interface etc.
A good solution I found was to split my application into 2 stacks: one for the S3 buckets and one for everything else. That way I have 2 scripts in my repo, one that does cdk deploy
for the S3 stack and one cdk deploy
for the other stack (for all other resources except S3 buckets).
The other good thing is that in CDK if you want to use that S3 construct in your code, you can now just pass it the bucket in your S3 stack (ie. not much code to change, just the reference to it) so it all still says in the same application, just has a separate deployment.
Upvotes: 1