How to create the resources across aws regions in one stack ?
See original GitHub issueHey friend, I have a aws pipeline that will deploy stuffs to the regions other than where it locates, which requires the creation of cross-region s3 buckets. Below is the code snippet:
export interface PipelineProps extends CDK.StackProps {
deploy: {stage: 'dev' | 'qa' | 'uat' | 'prod', regions:string[]},
github: { owner: string, repository: string, tokenName: string }
}
let myCrossRegionReplicationBuckets: { [region: string]: S3.IBucket; } = {}
for (const reg of props.deploy.regions) {
myCrossRegionReplicationBuckets.reg = new S3.Bucket(this, `${reg}-pipeline-bucket`, {
versioned: true,
encryption: S3.BucketEncryption.S3_MANAGED
})
}
const pipeline = new CodePipeline.Pipeline(this, id, {
crossRegionReplicationBuckets: myCrossRegionReplicationBuckets,
restartExecutionOnUpdate: true,
})
I noticed CDK.StackProps has a filed of env that includes one accountId and one region.
My question is: Is there a way to create the buckets in the regions defined in props.deploy.regions
instead of that defined in props.env.region
?
thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Reference resources across stacks in ...
1. Open the AWS CloudFormation console. 2. Choose Create Stack, and then choose Design template. 3. In the Parameters tab of the code...
Read more >Use CloudFormation StackSets to Provision Resources ...
You can now define an AWS resource configuration in a CloudFormation template and then roll it out across multiple AWS accounts and/or Regions...
Read more >Multiple-account, multiple-Region AWS CloudFormation
To do this, you can use the AWS::CloudFormation::Stack resource type, which launches the child stack into the same account, AWS Region, and AWS...
Read more >Creating a stack from existing resources - AWS CloudFormation
On the Stacks page, choose Create stack, and then choose With existing resources (import resources). · Read the Import overview page for a...
Read more >Creating a Multi-Region Application with AWS Services
IaC with AWS CloudFormation StackSets uses a single template to create, update, and delete stacks across multiple accounts and Regions in a ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
AWS CodePipeline supports cross-region deployment by deploying a specific stack in a specific region. If you wanted to deploy the same stack to multiple regions in CodePipeline, you would have to create 1 deployment action per region you wanted to deploy to.
AWS CloudFormation StackSets deploy a copy of each stack to each region, therefore each region has its own stack.
AWS Organization StackSets operate on the same principle as CloudFormation StackSets, just with some additional automation built in at the account creation process.
It is not possible to update resources across multiple regions with a single stack. I think its important to note the difference between “updating RegionA from RegionB” (well supported) and “updating RegionA and RegionC as an atomic transaction fromRegionB” (actively discouraged).
It is completely possible to build a cross-region deployment pipeline with CDK, what is not supported is updating multiple regions in a single stack because that capability is not present in CloudFormation.
@richardhboyd thanks for that, I know understand and agree with what is discouraged!!