AWS Classroom Series – 28/Dec/2019

Adding other resources

Internet Gateway

  • As of now our template looks like
{
    "AWSTemplateFormatVersion" : "2010-09-09",
    "Description" : "trying to create sample arch",
    "Resources": {
        "myVPC": {
            "Description": "This is VPC",
            "Type": "AWS::EC2::VPC",
            "Properties": {
                "CidrBlock" : "10.100.0.0/16",
                "EnableDnsHostnames": true,
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "From CF"
                    }
                ]

            }
        },
        
        "subnet1": {
            "Description": "first subnet",
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "us-west-2a",
                "CidrBlock" : "10.100.0.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "Subnet1"
                    }
                ],
                "VpcId": { "Ref": "myVPC" }
                

            }
        },

        "subnet2": {
            "Description": "first subnet",
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "us-west-2b",
                "CidrBlock" : "10.100.1.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "Subnet2"
                    }
                ],
                "VpcId": { "Ref": "myVPC" }
                

            }
        },
        "subnet3": {
            "Description": "first subnet",
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "us-west-2c",
                "CidrBlock" : "10.100.2.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "Subnet3"
                    }
                ],
                "VpcId": { "Ref": "myVPC" }
                

            }
        },
        "subnet4": {
            "Description": "first subnet",
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "us-west-2a",
                "CidrBlock" : "10.100.3.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "Subnet4"
                    }
                ],
                "VpcId": { "Ref": "myVPC" }
                

            }
        }
        
        
    }
}
  • To this template, lets add Internet Gateway, the template is as shown below
{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "trying to create sample arch",
    "Resources": {
        "myVPC": {
            "Description": "This is VPC",
            "Type": "AWS::EC2::VPC",
            "Properties": {
                "CidrBlock": "10.100.0.0/16",
                "EnableDnsHostnames": true,
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "From CF"
                    }
                ]
            }
        },
        "subnet1": {
            "Description": "first subnet",
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "us-west-2a",
                "CidrBlock": "10.100.0.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "Subnet1"
                    }
                ],
                "VpcId": {
                    "Ref": "myVPC"
                }
            }
        },
        "subnet2": {
            "Description": "first subnet",
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "us-west-2b",
                "CidrBlock": "10.100.1.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "Subnet2"
                    }
                ],
                "VpcId": {
                    "Ref": "myVPC"
                }
            }
        },
        "subnet3": {
            "Description": "first subnet",
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "us-west-2c",
                "CidrBlock": "10.100.2.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "Subnet3"
                    }
                ],
                "VpcId": {
                    "Ref": "myVPC"
                }
            }
        },
        "subnet4": {
            "Description": "first subnet",
            "Type": "AWS::EC2::Subnet",
            "Properties": {
                "AvailabilityZone": "us-west-2a",
                "CidrBlock": "10.100.3.0/24",
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "Subnet4"
                    }
                ],
                "VpcId": {
                    "Ref": "myVPC"
                }
            }
        },
        "learningigw": {
            "Type": "AWS::EC2::InternetGateway",
            "Properties": {
                "Tags": [
                    {
                        "Key": "Name",
                        "Value": "From CF"
                    }
                ]
            }
        },
        "AttachGateway": {
            "Type": "AWS::EC2::VPCGatewayAttachment",
            "Properties": {
                "VpcId": {
                    "Ref": "myVPC"
                },
                "InternetGatewayId": {
                    "Ref": "learningigw"
                }
            }
        }
    }
}
  • Now update the stack.
  • Now lets try to change some fields, subnet1 is in us-west-2a lets change that to us-west-2b. Before we do this we need to understand impact. Impact is documented by section Update requires, which has two values
    • replacement: recreate the resource (probably downtime)
    • No interruption: no impact ( zero downtime) Preview

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

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

Please turn AdBlock off
Social Network Widget by Acurax Small Business Website Designers
Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube