Sequence Technologies: Main Components of AWS Cloud Formation Template

SEQUENCE TECHNOLOGIES BLOGS

Discover More
App
Sequence Technologies, May 12, 2021

Components of AWS Cloud Formation Template

Cloudformation is a free service provided by AWS for implementing Infrastructure as-a Code solution. As we all know, it is really easy to build any solution in AWS from its UI only; however, when your infrastructure grows, a lot of manual efforts are needed and often manual efforts lead to human error. So to make deployment fast and reliable, AWS comes with a feature called Cloud formation which includes templates in the form of YAML or JSON language which can be used to spin whole AWS infrastructure CLI or feeding template to AWS cloud formation UI.

Let’s talk about major objects of Cloudformation which might be useful in your cloud journey.


1. Format Version

Format version basically tells which version of Cloudformation template you are going to use.


2. Description

As the name states, you can put description text to explain the purpose & feature of the template.

3. Metadata

This is also an optional item, mostly used to keep more detailed information about the resources that are going to be spun up.
 "Metadata" : {
    "Instances" : {"Description" : "My Instances"},
   "Databases" : {"Description" : "My DB"}
}

4. Parameters

Same as Parameters in other programming languages, Cloud Formation Parameters are used to define custom values at run time. For example- EC2 instance type etc.
 "Parameters" : {
  "InstanceTypeParameter" : {
   "Type" : "String",
   "Default" : "t2.micro",
  "AllowedValues" : ["t2.micro"],
  "Description" : "Enter t2.micro."
  }
 }

5. Mappings

Mappings is another optional section which is a key value pair that defines the value which is accepted for a particular value. For example- if you create an EC2 instance via template, you can use Region Name as key and Value as the desired AWS RegionName.
 "Mappings" : {
   "Mapping01" : {
     "Key01" : {
     "Name" : "Value01"
    },
     "Key02" : {
     "Name" : "Value02"
   },
     "Key03" : {
     "Name" : "Value03"
   }
 }
 }

6. Conditions

Conditions as the name suggests, we can input some condition in AWS templates with intrinsic functions, if conditions returns true then resources are created or updated, if not, they are simply ignored.
 "Conditions" : {
    "Logical ID":{Infu}
 }

7. Resources

This is a mandatory section which is used to define the resources which you are going to deploy as part of your template.
 "Resources" : {
   "MyEC2Instance" : {
    "Type" : "AWS::EC2::Instance",
   "Properties" : {
    "ImageId" : "ami-0ff"
   }
  }
 }

8. Output

This section is used to output the values after a template stack is executed , those values can be used by another stack if needed.
 "Export" : {
   "Name" : {
   "Fn::Join" : [ ":", [ { "Ref" : "AWS::StackName" }, "AccountVPC" ] ]
  }
 }

Should you use CloudFormation?


Cloud Formation is really useful when you try to deploy resources in AWS using automation. However, there are tools like Terraform which can replace it when it comes ot hybrid cloud and are platform independent as well.

Looking for DevOps or Cloud Team?
contactus@sequencetechno.com to get free consultation.

About Us

SEQUENCE TECHNOLOGIES

Software Services Provider based in Thailand & India.

Popular Posts


How to Reduce Cloud Budget


We are Growing

15 Projects
10 Clients
25 Technologies
2 Countries

Talk To Us

We provide Free Consultations, to know more or setting up a call with our team, please contact us as below.

Keep in touch

Emailus: contactus@sequencetechno.com

Callus: (+66)-873661545

Office Location:
The Knowledge Exchange
KX 110/1 Krung Thonburi Road, Banglamphulang, Klongsan, Bangkok 10600

We are Always there to assist.