- Newest
- Most votes
- Most comments
Hi, yes, you can. You have a full sample here based on S3 buckets: https://www.cloudxs.ch/2021/02/deploy-into-multiple-aws-regions-with-cloudformation/
You will have to replace the bucket with an EC2 instance in your use case.
This lab may also help: https://www.wellarchitectedlabs.com/reliability/200_labs/200_deploy_and_update_cloudformation/6_multi_region_deploy/
Hope it helps! Didier
Short answer: you can't. I recommend you use two different templates in two regions and update them independently.
As AWS CloudFormation is a regional service, there is no direct way within a template to create AWS resources in different regions than the one you are creating the stack in. There are although alternative workarounds that add complexity to your deployment:
- You may want to use AWS StackSet and using conditions in order to deploy the same template in two regions and filter based on the region it is deployed in.
- You may want to use a custom lambda function to create the resources in another region.
Note that updating resources in multiple regions that depend on each other is considered an anti-pattern and cannot properly be orchestrated within AWS.
This is exactly what I did not want to hear, but anyways thanks for the suggestions.
You need to have a more elaborate solution to be able to achieve this combined with CF Stackset. What you are missing is an orchestration pipeline that can deploy stacks in various regions from a central place. these resources can give you an idea about the concept :
Well, I need to list my template in AWS marketplace, so am not sure how would this CI/CD pipeline would come into picture there. Had it been used by just me, I would have done the CI/CD way but am quite skeptical with AWS Marketplace.
Relevant content
- asked 2 months ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
Hi, I think I was unable to elaborate my concern to you. Let's take an example of the template you shared above. So, How can I create 2 s3 bucket, one in us-east-1 and other in us-west-1 with totally different objects inside them using stack set from a single template?