Reputation: 9
I have a single stack with two instances RDS,EC2.I have to follow the structure that has root stack and two nested stack RDS,EC2.
Following should be the structure
1.Root stack
2.Webserver stack: All services related to EC2
3.DB stack: All services related to RDS
Upvotes: 1
Views: 492
Reputation: 238727
The general procedure would be as follows:
Extract rds and ec2 resources to its own template files (e.g. ec2.yaml, rds.yaml)
Parameterize ec2.yaml and rds.yaml, as well as add Outputs
section to them. The Outputs
are needed if you want to reference their return values in the Root stack.
Upload the ec2.yaml and rds.yaml into S3.
In the root stack create two resources of type AWS::CloudFormation::Stack
, i.e. one for rds and one for ec2. Use TemplateUrl to provide paths to locations in S3 (step 3). Use Parameters to define input parameters created in step 2.
Use GetAtt to reference outputs of the nested stack in the root stack.
Upvotes: 1