Use outputs to get access to informations about the resources created by a stack.
- Create a CloudFormation template using outputs.
- 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
InstanceId
containing the instance-id of the EC2 instance to the outputs section (see Outputs section and Resource Type: EC2 instance). - Launching the instance into a public subnet? Otherwise skip this step. Add
PublicIPAddress
containing the public IP address of the EC2 instance to the outputs section: Outputs section and Resource Type: EC2 instance). - Launching the instance into a private subnet? Otherwise skip this step. Add
PrivateIPAddress
containing the private IP address of the EC2 instance to the outputs section: Outputs section and Resource Type: EC2 instance).
- 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
lab4-$username
as stack name. Replace$username
with your username (e.g. lab4-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. - 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.
- Change to the Outputs tab.
- Find value of
InstanceId
and note it down. - Select the EC2 service from the main navigation.
- Search for an EC2 instance with the instance id from the outputs tab.
- Select the EC2 instance by clicking on the row of the table.
- Select the action Get System Log from the Actions menu hidden under Instance Settings.
- You will find the outputs from the load test in the logs.
- Switch back to the CloudFormation service.
- 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.