cloudsoft.io

Composing your First Template

Objectives

In this tutorial we will show you how to compose your first CloudFormation template. We will start with an extremely simple template, with a single EC2 instance.

Pre-requisites

This tutorial assumes you have a running instance, and have successfully logged into the instance from your browser.

Instructions

From the home page, select the CFN Composer:

CFN Export - home page

The CFN Composer has 4 main parts:

  • The canvas: this is where is displayed the graphical representation of the CloudFormation template you are creating.
  • The floating panel: that is the box on the left which shows different information based on the context:
    • A palette to choose and add resources.
    • The editor to view and edit the currently selected resource.

CFN Composer - palette

Choose from the palette your desired type of resource. To see the full list, ensure all of the filters are inactive (e.g. ‘Simplified’ is greyed out). Browse through the catalog, or search for your chosen resource type.

Tip: 'search' will look for any resource mentioning the given text, including in its description. The most specific search term to use is the resource type, such as 'aws::ec2::instance'.

Click on the resource type to add it to the canvas. When the item in the canvas is selected, the panel will show the resource’s configuration.

CFN Composer - resource config

Click on a given configuration option to enter a value for that property on the resource.

Tip: the default list shows mandatory configuration, those options that have been set, and commonly used options. To change what is listed, click on the 'Filter configuration' icon at the top of the configuration section (e.g. to tick 'All').

Fill in all the desired configuration.

CFN Composer - resource populated config

Click the ‘Export CFN’ button to export the CFN (which will save it to a local file).

For example, the graphical template shown above will generate:

---
AWSTemplateFormatVersion: "2010-09-09"
Description: "Application CloudFormation exported from Cloudsoft AMP"
Parameters: {}
Mappings: {}
Resources:
  AWSEC2Instance:
    Type: "AWS::EC2::Instance"
    Properties:
      ImageId: "ami-0bdb1d6c15a40392c"
      InstanceType: "t3.micro"
      SubnetId: "subnet-ea88fb8e"
      SecurityGroups:
      - "sg-08a4a56af8924486f"
      KeyName: "tutorial-example-keypair"
      Tags:
      - Key: "Name"
        Value: "Tutorial Example VM"
Outputs: {}
Tip: if there is an error, such as missing mandatory configuration, this will show as a red circle around the resource in the palette, and red against the invalid configuration (e.g. saying 'CidrBlock is required'). Some other errors may only be detected when the 'Export CFN' button is clicked, in which case a notification message will appear, explaining the problem.