SEQUENCE TECHNOLOGIES BLOGS
Discover More
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.
Format version basically tells which version of Cloudformation template you are going to use.
As the name states, you can put description text to explain the purpose & feature of the template.
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"}
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."
}
}
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"
}
}
}
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}
}
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"
}
}
}
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" ] ]
}
}
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.
We provide Free Consultations, to know more or setting up a call with our team, please contact us as below.
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.