AWS Classroomnotes 10/Aug/2023

Cloudformation (Contd)

  • The template which we have helps you in creating the vpc with 3 subnets
{
    "Resources": {
        "ntiervpc": {
            "Type": "AWS::EC2::VPC",
            "Properties": {
                "CidrBlock": "10.10.0.0/16",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "primaryvnet"
                    }
                ]
            }
        },
        "websubnet": {
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "ap-south-1a",
                "VpcId": {
                    "Ref": "ntiervpc"
                },
                "CidrBlock": "10.10.0.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "web"
                    }
                ]
            }
        },
        "appsubnet": {
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "ap-south-1a",
                "VpcId": {
                    "Ref": "ntiervpc"
                },
                "CidrBlock": "10.10.1.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "app"
                    }
                ]
            }
        },
        "dbsubnet": {
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "ap-south-1a",
                "VpcId": {
                    "Ref": "ntiervpc"
                },
                "CidrBlock": "10.10.2.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "db"
                    }
                ]
            }
        }
    }
}

Change 1: Parametrize cidr ranges

  • As of now the template always creates a network with range 10.10.0.0/16 and subnets with ranges
    • 10.10.0.0/24
    • 10.10.1.0/24
    • 10.10.2.0/24
  • Lets give option to the user to pass values dynamically
  • Refer Here for the changes done
    Preview
    Preview
  • Refer Here for the fix in cloud formation list

Change 2: Attach internet gateway

  • Create an internet gateway and attach it to the vpc
  • Refer Here for the cf resource of internet gateway and Refer Here for attachment
  • Refer Here for the changes
    Preview
    Preview

Change 3: Create a route table

  • For manual steps refer class room video
  • Refer Here for resource
  • Create a route table with tag key = Name and value = Public
  • Refer Here for the changes and Refer Here for the changeset to rename logical name
    Preview
    Preview

Exercise

  • Create a route table with tag key = Name and value = Private

Concepts

  • Refer Here for Cloudformation docs on parameters
  • AWS allows us to pass values by using Cloudformation paramters,
  • There are two types on paramters
    • user defined
    • AWS defined
  • Supported types in paramters Refer Here

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
Animated Social Media Icons by Acurax Wordpress Development 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