AWS Classroomnotes 20/Aug/2022

Cloud Formation

  • Generally to create an application architecture in AWS we use
    • Console
    • CLI
  • To create infrastructure, we have infrastructure as code (IAC)
  • Using IAC we express the infrastructure as a desired state to create a template
  • When we execute this template a Stack gets created which ensures the resources are in desired state.
  • We have different Infra Provisioing tools
    • Terraform
    • ARM Templates (Azure)
    • CloudFormation (AWS)
  • AWS CloudFormation Template can be describe in
    • JSON
    • YAML
  • Cloud formation Stack creates all resources or no resources.
  • For the Changes which we want, we can update the desired in the template and further update the stack.
  • When we delete the stack, it deletes all resources.

AWS Cloud Formation Template Structure

  • Refer Here
  • Install an Extension in Visual Studio Code for AWS Cloudformation
    Preview
  • Lets understand resource Refer Here
  • Basic Skeleton
{
    "AWSTemplateFormatVersion" : "2010-09-09",
    "Description": "This is skeleton",
    "Resources": {
        "resource-1": {
            "Type": "",
            "Properties": {

            }
        }
    }
}

Activity 1:

  • Create a VPC with cidr range 192.168.0.0/16
  • Refer Here for the changes done to create a ntier vpc
  • Now we have a template, lets create stack
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview

Activity 2: Add 4 subnets to existing template and update the stack

  • Refer Here for the changes.
  • Now lets update the stack.
    Preview
    Preview
    Preview

Activity 3: Lets Make this template reusable with dynamic AZ

Activity 4: Lets make cidr ranges also parametrized

Activity 5: Lets add internet gateway and route tables

Activity 6: Lets create a security group with 22 and 80 port open and create ec2 instance in public subnet

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner