Use input parameters to be able to re-use CloudFormation templates-
- Create a CloudFormation template accepting input parameters and using them to configure an EC2 instance.
- 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 parameter called
AMI
of typeString
to theParameters
section (see Parameters section). - Add a parameter called
InstanceType
of typeString
to theParameters
section (see Parameters section). - Add a parameter called
Subnet
of typeAWS::EC2::Subnet::Id
to theParameters
section (see Parameters section).
- 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
lab2-$username
as stack name. Replace$username
with your username (e.g. lab2-awittig). - Select a random subnet as parameter for Subnet.
- Insert
t2.micro
as parameter for InstanceType. - Insert
ami-bff32ccc
(eu-west-1) orami-bc5b48d0
(eu-central-1) as parameter for AMI. - 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.