Skip to content

Latest commit

 

History

History
 
 

lab06-mappings

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Lab 6: Mappings

Mappings are mapping a key to a set of values. Typical use case: defining a mapping between a region and an AMI.

Overview

  1. Create a CloudFormation template defining a mapping for AMIs based on the region.
  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 mappings section to your template (see Mappings section).
  3. Add a mapping named RegionAMIMap. The mapping should contain a region id as key, AmazonLinux as name and the AMI id as value per region (see Mappings section)).
  4. Use the mapping RegionAMIMap to define the AMI for the EC2 instance (see Mappings section) and Resource Type: EC2 instance.

AMIs per region

ap-northeast-1 => ami-cbf90ecb
ap-southeast-1 => ami-68d8e93a
ap-southeast-2 => ami-fd9cecc7
eu-central-1 => ami-a8221fb5
eu-west-1 => ami-a10897d6
sa-east-1 => ami-b52890a8
us-east-1 => ami-1ecae776
us-west-1 => ami-d114f295
us-west-2 => ami-e7527ed7

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 lab6-$usernameas stack name. Replace $usernamewith your username (e.g. lab6-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.