Making use of nested stacks. Use modules trying to avoid complex and large templates.
- Create a CloudFormation template combining to other templates.
- Create a CloudFormation stack based on your template.
- Open
stub.yaml
with an editor of your choice. The stub file contains a skeleton to start from. - Add a resource to create a child stack based on
https://s3-eu-west-1.amazonaws.com/learn-cloudformation/lab7-nested-stacks/ec2-stack.json
(see Resource Type: CloudFormation Stack). - Add a resource to create a child stack based on
https://s3-eu-west-1.amazonaws.com/learn-cloudformation/lab7-nested-stacks/s3-stack.json
(see Resource Type: CloudFormation Stack). - Handover parameter
InstanceId
from EC2 stack to S3 stack. - Forward all parameters from parent template to
ec2-stack
stack. - Add outputs referencing outputs from
ec2-stack
stack (see Resource Type: CloudFormation Stack).
- Open CloudFormation in AWS Management Console.
- Click Create Stack button.
- Select Upload a template to Amazon S3.
- Choose the template file you created for this lab.
- Click Next button.
- Insert
lab7-$username
as stack name. Replace$username
with your username (e.g. lab7-awittig). - Select a random subnet as parameter for Subnet.
- Select a random key as parameter for Key Pair.
- Insert
t2.micro
as parameter for InstanceType. - Insert
http://widdix.net/
or a website you own for URL. - Click Next button.
- Skip next step by clicking on Next button.
- Review your input and click Create button.
- Wait until your stack reaches status CREATE_COMPLETE.
- Select your stack by clicking on row of the table.
- Select Delete Stack from the Actions menu.
- Confirm the deletion of your stack.
- Congratulations! You are done with the lab!
This lab includes a sample solution sample-solution.yaml
. Use it if you are stuck during the creation of your template of if you want to review your results.