-
Notifications
You must be signed in to change notification settings - Fork 4k
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
codepipeline: Deploying cross-account and regions while reusing existing S3 bucket and KMS key. #26557
Comments
The error comes from here: aws-cdk/packages/aws-cdk-lib/aws-codepipeline/lib/pipeline.ts Lines 744 to 755 in cb97232
But I wonder why aws-cdk/packages/aws-cdk-lib/aws-codepipeline/lib/pipeline.ts Lines 136 to 151 in cb97232
|
Since bucket and corresponding KMS key are explicitly provided, I didn't want CDK to create a new KMS key on my behalf, hence Based on the source code link that you shared, it looks like there is another concept in play that deals with Need to investigate this further. |
Hi I am still working on this to figure out the solution. From what I've learned from the source code, if you are creating the pipeline with pipelines.CodePipeline class and its props, basically it does not allow you to specify an existing bucket with existing key for the remote region and looks like it always creates a new remote stack and bucket for you. However, if you look at codepipeline.Pipeline and its props, you are allowed to specify crossRegionReplicationBuckets and pass the self-created codepipeline to the codePipeline prop for pipelines.CodePipeline. This indicates it might be possible to use existing S3 bucket and MKS key for the codepipeline with cdk-pipelines. I am still trying to create a working sample with that but I hope this could be a workaround. |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
I am facing this same issue. Very hard to find success stories of this setup on the web. The suggested solution does not work. Not sure how it even ran for @pahud. It's a circular reference scenario. Account_A Stack is referencing Account_B Stack resources and vise verse. Whichever Stack you run first will fail. Anyways, I ran into a diff issue with the suggested solution. Specifically these lines..
Anyways, I will continue vetting a solution as this seems like a big mess using CDK. |
Hi, I solved the problem of referencing buckets by simple naming and KMS keys (that dont have names) by creating a custom resource to look them up by alias. Actually, I tried to solve all the resource sprawl problems you typically get with the AWS CDK libraries, in a pipeline libary I created: https://medium.com/@gmournos/creating-professional-aws-native-delivery-pipelines-with-cdk-c2aed59be6e7 https://medium.com/@gmournos/creating-professional-aws-native-delivery-pipelines-with-cdk-part-2-68fde253c34e It is quite robust, I have been using it in production for one year. I built the Medium articles as a tutorial, so if you do not want to use the library as is, you can easily pick the individual steps that treat resources sprawl and adjust them to your project. Specifically: Hope this helps G Mournos |
I'm shocked at how complicated it is to set up a simple pipeline. I am trying to use CodePipeline to deploy some artifacts to an S3 bucket in a different account. This should be a walk in the park with the level of CDK maturity. Yet I've struggled for 1+ days, and I am still not done. And I've been using CDK almost daily since 2020! |
Describe the bug
Pipeline defined in region
us-east-2
.Pipeline uses existing S3 artifacts buckets with KMS key.
Pipelined includes two stages to deploy stacks into two regions
us-east-1
andus-east-2
in target account.Note: when deploying just to one region
us-east-2
in target account, everything works fine.Expected Behavior
Pipeline is successfully created which includes two stages that deploy to "us-east-1" and "us-east-2" regions in target account.
Current Behavior
Exception is received during
cdk synth
Reproduction Steps
Possible Solution
No response
Additional Information/Context
When target account region matches pipeline region, then no error is raised.
Also tried to specify
env
on each individual stack withinDeployStage
, instead have it specified onDeployStagae
, but still resulted in the same error.CDK CLI Version
2.88.0 (build 5d497f9)
Framework Version
No response
Node.js Version
v16.16.0
OS
Windows 10
Language
Typescript
Language Version
TypeScript (5.1.6)
Other information
No response
The text was updated successfully, but these errors were encountered: