I am attempting to setup CDK (v2) Stack using TypeScript to create a Pipeline Stack (Account A, region A) that contains Stages. One stage being CloudFormationCreateUpdateStackAction()
for Account B, region B.
Hard to find examples online for this setup. Has anyone attempted this before?
This github solution did not work for me:
- https://github.com/aws/aws-cdk/issues/11965
I am not sure the correct configuration for this. The blocker/issue relates to the Artifact Bucket(s) and KMS Key. Depending on setup, I’ve seen the following errors:
Error: Cannot add assets to a Stack that uses the BootstraplessSynthesizer
An error occurred while validating the artifact bucket 'ACCOUNT_B_BUCKET_NAME':The bucket named ACCOUNT_B_BUCKET_NAME is not located in the REGION_B AWS region. Choose a valid artifact bucket in 'REGION_B', or create a new artifact bucket to use in your pipeline.
Error: Artifact Bucket must have a KMS Key to add cross-account action 'ACTION_STAGE_NAME' (pipeline account: 'ACCOUNT_A', action account: 'ACCOUNT_B'). Create Pipeline with 'crossAccountKeys: true' (or pass an existing Bucket with a key)
I would expect the CDK Stack to be smart enough to create/allow the creation of cross-account and cross-region resources to deploy based on the properties of the CDK Constructs.
1
Would be easier to help if you share the configuration you used.
Its seems that you are trying to avoid bootstrapping, after it failed you try to provide a bucket manually, and at the last you didn’t but you didn’t added crossAccountKeys: true
.
Im in the dark here, but seems like it.
Use bootstrapping like the last but config with crossAccountKeys, make sure that the account have in their roles cloudFormationExcusingPolicies administrator, and account B configured to trust the pipeline.
And if im wrong, give the code samples.
Would add it as a comment, but too poor for it, apologize.