You are currently viewing CloudFormation Designer

CloudFormation Designer

CloudFormation Designer

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have created a CloudFormation template using YAML.

https://cloudaffaire.com/create-cloudformation-template/

In this blog post, we are going to create a CloudFormation stack using designers. The stack will contain VPC, subnet and one EC2 instance.

CloudFormation Designer

Step 1: Login to AWS console and navigate to ‘CloudFormation’.

CloudFormation Designer

Note: For shortening of the code, only has AMI mapping for APAC regions. Make sure you are in any one of the APAC region.

Step 2: Click ‘Create Stack’.

CloudFormation Designer

Step 3: Select ‘Create template in Designer’ and click ‘Create template in designer’.

CloudFormation Designer

Step 4: Change the name of your template and select YAML as the template language.

CloudFormation Designer

Step 5: In the ‘Parameters’ tab paste below YAML code.

CloudFormation Designer

Make sure indentation is correct, you can also use cloudformation_designer_demo.yaml from below GitHub repo.

https://github.com/CloudAffaire/CloudFormation

Note: Every time you make any changes to the template in the designer, it will ask for a refresh. Click on the refresh icon to refresh the designer.

CloudFormation Designer

CloudFormation Designer

Step 6: Click on ‘Mapping’ tab under ‘Components’ and paste below code.

CloudFormation Designer

Note: You can define other template elements as well by selecting the respective element tabs. Next, we will add resources to our template.

Make sure indentation is correct in the above code, you can also use cloudformation_designer_demo.yaml from below GitHub repo.

https://github.com/CloudAffaire/CloudFormation

Step 7: Expand ‘EC2’ resource type and drag ‘VPC’ to designer and in the ‘Properties’ tab, edit the name of the resource to ‘myVPC’.

CloudFormation Designer

Next, we are going to create the subnet which will host the EC2 instance.

Step 8: Drag ‘Subnet’ under ‘myVPC’ in designer and in the ‘Properties’ tab, edit the name of the resource to ‘mySUBNET’.

CloudFormation Designer

Observe: Designer has automatically assigned VPC id reference of ‘myVPC’ to ‘mySUBNET’ VpcId property. Hence ‘mySUBNET’ will be created under ‘myVPC’.

Step 9: Drag ‘Instance’ under ‘mySUBNET’ in designer and in the ‘Properties’ tab, edit the name of the resource to ‘myINSTANCE’.

CloudFormation Designer

We have previously defined parameters and mapping for our template. To make the resources use those, we need to manually update the resource section of the template code.

Step 10: Update the resource properties under ‘Template’.

myVPC:

mySUBNET:

myINSTANCE:

CloudFormation Designer

Note: Make sure your code indentation is correct or you will get an error. You can also use cloudformation_designer_demo.yaml from below GitHub repo.

https://github.com/CloudAffaire/CloudFormation

Our template is ready for deployment. Next, we are going to create a stack using this template.

Step 11: Click on the cloud icon to upload this template in S3 and create a stack.

CloudFormation Designer

You will be redirected to stack creation window.

CloudFormation Designer

Step 12: Provide the parameters for your stack and create the stack.

CloudFormation Designer

Step 13: Cleanup.

CloudFormation Designer

Note: This will also delete the underlying resources for this stack.

Hope you have enjoyed this article. In the next blog post, we will discuss intrinsic functions in CloudFormation.

To get more details on CloudFormation, please refer below AWS documentation

https://docs.aws.amazon.com/cloudformation/index.html

 

This Post Has One Comment

  1. Avatar
    li

    I need help plis

Comments are closed.