Cloud formation & Snippets Template

Cloud formation & Snippets Template

July 1, 2020 / Eternal Team

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.

Benefits

  1. Less time as compared to when the configuration is done manually.
  2. Free to use (however you are charged for what you create and usage of AWS services).
  3. Can be used to manage updates & dependencies.
  4. Can be used to rollback and delete entire stack as well.

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"
      ]
    },

If you want to know more please visit link.

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.

Want to start a project?

It’s simple.

Contact us