MultiCloud Classroom notes 31/May/2025

Cloudformation

  • AWS Cloudformation allows us to create infra based on a template
  • Template can be written in json/yaml format
  • JSON is a file format for representing data. JSON follows key value pair to define it structure
"<key>": <value>
  • Value can be of different types
    • text: this is generally surrounded with single or double quotes "movie": "retro" or 'movie': 'retro'
    • numer: This is any number 'runtime': 130
    • boolean: This has two values true or false 'theare': false
    • list/array: this has values of any type in [] 'actors': ['surya', 'pooja']
    • map/dictionary/object: this generally represents a complex type which requires more key value pairs to describe. This is surronded with {}
{
    "name": "Multicloud",
    "starttime": "19:00",
    "topics": ["json", "yaml", "cf"],
    "mode": ["online", "offline"],
    "where": {
        "flat": "601-A",
        "building": "nilgiri",
        "city": "Hyberabad"
    }
}
  • YAML is a file format for representing data. YAML follows key value pair to define it structure
key: <value>
  • Value can be of different types

    • text: this is generally surrounded with single or double quotes movie: "retro" or movie: 'retro' or movie: retro
    • numer: This is any number runtime: 130
    • boolean: This has two values true or false or yes or no theare: no
    • list/array: this has values of any type in [] actors: ['surya', 'pooja']
      “`yaml
      actors:</li>
      <li>surya</li>
      <li>pooja
      “`
    • map/dictionary/object: this generally represents a complex type which requires more key value pairs to describe. This is surronded with {}
      “`yaml
      address:
      flatno: 601-A
      building: nilgiri</li>
      </ul>
      “`
      * Example
    ---
    name: Multicloud
    starttime: '19:00'
    topics:
      - json
      - yaml
      - cf
    mode:
      - online
      - offline
    where:
      flat: 601-A
      building: nilgiri
      city: Hyberabad
    
    

    Preview

    Building Blocks of Cloudformation

    • Template: This uses a json or a yaml file in a format defined by aws Format
    • Stack: When we want to create infra, we create a cloudformation stack, where we pass the template. By default stack creates everything or nothing. stacks can be updated to recreate/modify the infrastructure created.

    Template components

    Minimial Template

    • This requires only Resources
    {
        "Resources": {
            "mybucket": {
                "Type" : "AWS::ServiceName::ResourceType",
                "Properties" : {
                    "PropertyName1" : "PropertyValue1",
                }
    
            }
        }
    }
    

    Lets create a cloudformation template for Network

    • Create a new folder & open in visual studio code
    • Create a new file main.json
    • To find the structure of vpc google aws cloudformation vpc
      Preview
      Preview
    • This is our first template
    {
        "Resources": {
            "network" : {
                "Type" : "AWS::EC2::VPC",
                "Properties": {
                    "CidrBlock": "192.168.0.0/16",
                    "EnableDnsHostnames": true,
                    "Tags": [{
                        "Key": "Name",
                        "Value": "from-cf"
                    }]
                }
            }
        }
    }
    
    • To create a cf stack watch classroom recording
    • To be productive in terms of authoring templates, visual studio code has extensions
      Preview
    • Refer Here for the changes done.

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Integration by Acurax Wordpress Developers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube