AWS Classroom Series – 11/Jul/2021

What CloudFormation Does ?

  • Assume you have to deploy an application in AWS which needs

    • ec2 instance to be created
    • install necessary softwares
    • Open necessary security groups
  • Possible options

    • manual
      • Create ec2 instance manually
      • deploy the application by logging into the ec2 instance
      • Open necessary ports
    • Scripting: Create a shell script which uses aws cli to
      • create ec2 instance
      • install necessary softwares
      • open selected ports
  • We need to create multiple environments of the same application which involves

    • creating the application infra
    • deleting the application infra after use
  • Lets see the following to use cloud formation Preview Preview Preview Preview Preview Preview Preview Preview Preview Preview Preview

  • Deleting the stack will delete all the resources created by cloudformation

  • If we can have similar template for deploying our application developed, creating various environments will be simple

  • We can deploy a cf template from command line as well which helps us in automating application deployment from CI/CD tools like jenkins

  • To work with Cloud formation templates i.e creating templates we need to have the following skills

    • JSON/YAML format Refer Here for the JSON and YAML Tutorial
    • How to create the application/resources manually.
  • Exercise: Try creating a single machine Lamp server using cloud formation template.

JSON or YAML

  • Both JSON and YAML are used to represent data and they are collection of name value pairs
  • In json the syntax of each name pair
<name>: <value>
  • In yaml the syntax of each name value pair
<name>: <value>
  • When we describe about any thing the value can be

    • Text
    • Number
    • Boolean
    • List
    • Complex i.e. this requires more name value pairs to describe
  • JSON Way

    • Text:
    "name": "QualityThought"
    
    • Number
    "age": 11
    
    • Boolean
    "classroom": false
    "online": true
    
    • list
    "courses": ["AWS", "Azure", "DevOps", "Python", "Expert K8s"]
    
    • complex
    "address": {
        "flatno": "209-b",
        "building": "nilgiri",
        "area": "Ameerpet"
    }
    
    • Whole json
    {
      "name": "QualityThought",
      "age": 11,
      "offline": false,
      "courses": [ "AWS", "Azure", "DevOps", "Python", "DataScience", "QA" ],
      "address": {
        "flatno": "209-b",
        "building": "nilgiri",
        "area": "Ameerpet"
      }
    }
    
  • YAML Way:

    • Text:
    name: QualityThought
    
    • Number
    age: 11
    
    • Boolean
    online: true
    online: yes
    classroom: no
    
    • list
    courses:
      - AWS
      - Azure
      - DevOps
      - Python
      - Expert k8s
    
    • complex:
    address:
      flatno: 209-b
      building: nilgiri
      area: ameerpet
    
    • Whole yaml
name: Quality Thought
age: 11
online: yes
offline: no
courses:
  - AWS
  - Azure
  - DevOps
  - Python
  - Expert k8s
address:
  flatno: 209-b
  building: nilgiri
  area: ameerpet

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

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