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)