July 1, 2020 / Nirav Shah
Cloud formation is a service that allows you to manage, configure and provision your AWS infrastructure as code and all resources are defined using cloud formation template. This template interacts with API calls and creates resources that you define.
It supports YAML and JSON.
Now let’s see what is a cloud formation template.
YAML or JSON template used to describe the end state of the infrastructure you are either provisioning or changing.
You can upload the cloud formation template on s3 bucket.
Cloud formation reads the temples and makes the API call on your behalf.
The resulting resources are called a stack.
AWS Cloudformation Template format is shown in the following YAML template.
AWSTemplateFormatVersion: "2010-09-09" Description: A sample template Resources: MyEC2Instance: #An inline comment Type: "AWS::EC2::Instance" Properties: ImageId: "ami-0ff8a91507f77f867" #Another comment -- This is a Linux AMI InstanceType: t2.micro KeyName: testkey BlockDeviceMappings: - DeviceName: /dev/sdm Ebs: VolumeType: io1 Iops: 200 DeleteOnTermination: false VolumeSize: 20
So from the above example, you can see that this template is about creating an EC2 instance and the size is t2 micro, and we have set the permission to delete on termination. And the keyname is testkey.
So it’s very easy to understand. Here we have defined the JSON format.
"Metadata": { "AWS::CloudFormation::Designer": { "6b56eaae-0bb6-4215-aad6-12345EXAMPLE": { "size": { "width": 60, "height": 60 }, "position": { "x": 340, "y": 430 }, "z": 2, "parent": "21ccc9b0-29e9-4a86-9cf2-12345EXAMPLE", "embeds": [], "ismemberof": [ "c3eead73-6a76-4532-9268-12345EXAMPLE" ] },
What is Template Snippets
It provides a number of example scenarios that you can use to understand how to declare various AWS CloudFormation template parts.
Like….
Please visit the links to get more information.
Also Read: AWS Elastic Beanstalk vs OpsWorks vs CloudFormation
As a Director of Eternal Web Private Ltd an AWS consulting partner company, Nirav is responsible for its operations. AWS, cloud-computing and digital transformation are some of his favorite topics to talk about. His key focus is to help enterprises adopt technology, to solve their business problem with the right cloud solutions.
Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.