Skip to content

Latest commit

 

History

History
 
 

lab05-dependencies

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Lab 5: Dependencies between resources

CloudFormation detects dependencies between resources and creates, updates, or deletes the resources in the correct order.

Overview

  1. Create a CloudFormation template defining dependencies between resources.
  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 reference to SecurityGroup to the list of SecurityGroupIds of the EC2 instance (see Reference function).
  3. Add a reference to the parameter KeyName to the KeyNameof the EC2 instance (see Reference function).

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 lab5-$usernameas stack name. Replace $usernamewith your username (e.g. lab5-awittig).
  7. Select a random subnet as parameter for Subnet.
  8. Select a random key as parameter for Key Pair.
  9. Insert ami-bff32ccc (eu-west-1) or ami-bc5b48d0(eu-central-1) as parameter for AMI.
  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. Change to the Outputs tab.
  17. Find value of InstanceId and note it down.
  18. Select the EC2 service from the main navigation.
  19. Search for an EC2 instance with the instance id from the outputs tab.
  20. Select the EC2 instance by clicking on the row of the table.
  21. Search for the Security Group attached to the EC2 instance and check if it allows incoming traffic to port 22.
  22. Switch back to the CloudFormation service.
  23. Select your stack by clicking on row of the table.
  24. Select Delete Stack from the Actions menu.
  25. Confirm the deletion of your stack.
  26. 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.