AWS Classroomnotes 25/Mar/2023

Infrastructure as Code (IaC)

  • This represents expressing infra as a Desired state and let the IaC tool do the rest.
  • Popular IaC tools
    • Terraform
    • Cloud Formation
    • ARM Templates
    • Azure Bicep

AWS Cloudformation

  • AWS Cloudformation, allows us to express the desired state in json or yaml format and when executed (Created stack) will create infra
  • Workflow
    • Author a template
    • upload to s3 directly or indirectly
    • Creates changeset (what has to be created/updated)
    • Executes to realize infra.
  • Refer Here for CF concepts
  • Template: Desired state expressed in json or yaml
  • Stack: Represents the execution of Template
  • Changeset: This represents the infra to be updated/created/deleted.
  • To author an Cloud formation template
    • JSON/YAML Knowledge
    • Manual steps of how to create infra
    • Productivity:
      • Visual Studio Code with Cloudformation extension

Cloudformation Template Grammar/Syntax

{
  "AWSTemplateFormatVersion" : "version date",

  "Description" : "JSON string",

  "Metadata" : {
    template metadata
  },

  "Parameters" : {
    set of parameters
  },

  "Rules" : {
    set of rules
  },

  "Mappings" : {
    set of mappings
  },

  "Conditions" : {
    set of conditions
  },

  "Transform" : {
    set of transforms
  },

  "Resources" : {
    set of resources
  },

  "Outputs" : {
    set of outputs
  }
}
  • YAML
---
AWSTemplateFormatVersion: "version date"

Description:
  String

Metadata:
  template metadata

Parameters:
  set of parameters

Rules:
  set of rules

Mappings:
  set of mappings

Conditions:
  set of conditions

Transform:
  set of transforms

Resources:
  set of resources

Outputs:
  set of outputs

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "",
    "Resources": {

    }
}
  • Skeleton (YAML):
---
AWSTemplateFormatVersion: '2010-09-09'
Description: ''
Resources: {}

Activity 1: Create an S3 bucket using Cloud formation

  • Way of Working (WoW):
    • Manual steps for creation
    • Lets make a note of inputs which we provide while creating s3 bucket
  • Manual Steps:





  • Search for resource type and syntax
  • s3 resource in cloud formation Refer Here
  • Refer Here for the template created
  • Create stack:







Activity 2: Create a vpc

  • Refer Here for manual steps
  • inputs
    • Name tag
    • cidr: 192.168.0.0/16
  • Create stack from the template

Exercises:

  • Create a cloudformation template to
    • Create a user in IAM
    • Create a group in IAM
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel 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

Exit mobile version
%%footer%%