You are on page 1of 4

Hands-on Lab

Creating a Template
with CloudFormer
Contents
Create an S3 Bucket 1

Create Resources 1

Create an EC2 Instance 1

Create Stack 2

Create Template 2

Review 2
Creating a Template with CloudFormer Linux Academy + Cloud Assessments

In this lab, we are creating a CloudFormer template that will use resources we create. To do
so, we will perform actions that you have already completed, such as creating those resources,
making an EC2 instance, and creating a stack.

Create an S3 Bucket
Before we get started, we need to create an S3 bucket that will store our template. If you need
a refresher on how to do so, click here to view the lab Introduction to Templates and Stacks.

Create Resources
Before we create a template, we need resources for CloudFormer to pull from. For this lab, we’ll
create a VPC, an internet gateway, a subnet, a route table, and an EC2 instance.

Under Services and Networking & Content Delivery, select VPC; then, from the sidebar,
choose Your VPCs. Select Create VPC. On the Create VPC page, set the Name tag to
CloudFormerVPC, the CIDR block to 10.0.0.0/16, and keep the other defaults.

On the VPC Dashboard sidebar, select Internet Gateways. Name the gateway CloudFormerIGW.
With it created, we want to attach it to our VPC using the Attach to VPC button at the top of
the screen.

From the sidebar, select Subnets and name it PublicSubnet. Make sure that it is connected to
the CloudFormerVPC, which we can do in the VPC dropdown. In the IPv4 CIDR block section,
enter a CIDR of 10.0.0.0/24. Select Yes, Create, and then connect it to the VPC.

The last resource we need to create is a route table. Select the option from the side bar and
name it CloudFormerRoute. Check to make sure it is connected to the CloudFormerVPC and
then select Yes, create.

Create an EC2 Instance


With the resources created, we now need an EC2 instance. We don’t need to do much with it,
so go ahead and select the first instance type from the Quick Start page and set it as a t2.micro.
Select Next: Choose Instance Type.

When configuring the instance details, make sure that the Network is set to CloudFormerVPC,
and that the Subnet is set to our PublicSubnet. Everything else can stay as the default. When
prompted, select Launch. Create a new key pair when prompted and name it CloudFormer.
Don’t forget to select Download Key Pair. With that created, select Launch Instance.

-1-
Creating a Template with CloudFormer Linux Academy + Cloud Assessments

We now have resources for CloudFormer to review.

Create Stack
Time to set up our stack. Go to CloudFormation and choose Create Stack. From the sample
template dropdown, choose CloudFormer. On the Specify details page, name the stack
cformer, and set both the password and username to cformerlab,

Note that the password must be over eight characters in length. If not, you will get an error
about it, though it will tell you it is a numerical issue instead of a length issue.

Hit Next through the next two pages. On the last page, make sure that I acknowledge that AWS
CloudFormation might create IAM resources. is checked.

Select Create and review the resources on the Events tab.

Create Template
On the Stacks page, under the Outputs tab for our cformer stack, we have a link to our
instance in the Value section. Click on it and it will take you to the instance. Be aware that you
may get a few popups or prompts asking if you want to head to the site, as it will be seen as an
unsecured site. You will be prompted to sign in as well. Use cformerlab for both the password
and username.

Select Create Template. When asked for a description, enter cformer lab and check the box
designating that the template will Select all resources in your account. Select Continue and
then keep selecting it to review all items in the template and accept all of the defaults. Once at
the end, select Save Template.

The template is finished and ready for use.

Review
With the completion of this lab, you are able to successfully create a template using CloudFormer.
Feel free to continue to practice in the lab environment, adding other resources, creating different
settings in an EC2 instance, and so on. Congratulations on completing this section!

-2-

You might also like