Skip to content

Latest commit

 

History

History
 
 

lab07-nested-stacks

Lab 7: Nested stacks

Making use of nested stacks. Use modules trying to avoid complex and large templates.

Overview

  1. Create a CloudFormation template combining to other templates.
  2. Create a CloudFormation stack based on your template.

Instructions

Create a template

  1. Open stub.yaml with an editor of your choice. The stub file contains a skeleton to start from.
  2. 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).
  3. 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).
  4. Handover parameter InstanceId from EC2 stack to S3 stack.
  5. Forward all parameters from parent template to ec2-stack stack.
  6. Add outputs referencing outputs from ec2-stack stack (see Resource Type: CloudFormation Stack).

Create a stack based on the template

  1. Open CloudFormation in AWS Management Console.
  2. Click Create Stack button.
  3. Select Upload a template to Amazon S3.
  4. Choose the template file you created for this lab.
  5. Click Next button.
  6. Insert lab7-$usernameas stack name. Replace $usernamewith your username (e.g. lab7-awittig).
  7. Select a random subnet as parameter for Subnet.
  8. Select a random key as parameter for Key Pair.
  9. Insert t2.micro as parameter for InstanceType.
  10. Insert http://widdix.net/ or a website you own for URL.
  11. Click Next button.
  12. Skip next step by clicking on Next button.
  13. Review your input and click Create button.
  14. Wait until your stack reaches status CREATE_COMPLETE.
  15. Select your stack by clicking on row of the table.
  16. Select Delete Stack from the Actions menu.
  17. Confirm the deletion of your stack.
  18. Congratulations! You are done with the lab!

Documentation

Sample solution

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.