Thursday, 25 May 2017

AWS VPC with a NAT Gateway Cloudformation code



{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "A VPC environment in two availability zones with an NAT Gateway.",
  "Parameters": {
    "envPrefix": {
      "Description": "Environment name prefix.",
      "Type": "String",
      "Default": "Test"
    },
    "vpcCidr": {
      "Description": "VPC CIDR block.",
      "Type": "String",
      "Default": "10.60.0.0/22",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x."
    },
    "publicSubnet1Cidr": {
      "Description": "Public subnet 1 CIDR block.",
      "Type": "String",
      "Default": "10.60.0.0/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"publicSubnet2Cidr": {
      "Description": "Public subnet 2 CIDR block.",
      "Type": "String",
      "Default": "10.60.0.32/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
 
    "publicSubnet3Cidr": {
      "Description": "Public subnet 3 CIDR block.",
      "Type": "String",
      "Default": "10.60.0.64/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"publicSubnet4Cidr": {
      "Description": "Public subnet 4 CIDR block.",
      "Type": "String",
      "Default": "10.60.0.96/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
    "privateSubnet1Cidr": {
      "Description": "Private subnet 1 CIDR block.",
      "Type": "String",
      "Default": "10.60.0.128/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet2Cidr": {
      "Description": "Private subnet 2 CIDR block.",
      "Type": "String",
      "Default": "10.60.0.160/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet3Cidr": {
      "Description": "Private subnet 3 CIDR block.",
      "Type": "String",
      "Default": "10.60.0.192/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet4Cidr": {
      "Description": "Private subnet 4 CIDR block.",
      "Type": "String",
      "Default": "10.60.0.224/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet5Cidr": {
      "Description": "Private subnet 5 CIDR block.",
      "Type": "String",
      "Default": "10.60.1.0/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet6Cidr": {
      "Description": "Private subnet 6 CIDR block.",
      "Type": "String",
      "Default": "10.60.1.32/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet7Cidr": {
      "Description": "Private subnet 7 CIDR block.",
      "Type": "String",
      "Default": "10.60.1.64/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet8Cidr": {
      "Description": "Private subnet 8 CIDR block.",
      "Type": "String",
      "Default": "10.60.1.96/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet9Cidr": {
      "Description": "Private subnet 9 CIDR block.",
      "Type": "String",
      "Default": "10.60.1.128/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet10Cidr": {
      "Description": "Private subnet 10 CIDR block.",
      "Type": "String",
      "Default": "10.60.1.160/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet11Cidr": {
      "Description": "Private subnet 11 CIDR block.",
      "Type": "String",
      "Default": "10.60.1.192/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },
"privateSubnet12Cidr": {
      "Description": "Private subnet 12 CIDR block.",
      "Type": "String",
      "Default": "10.60.1.224/27",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x and subnet of VPC."
    },

    "subnet1AZ": {
      "Description": "Subnet 1 availability zone.",
      "Type": "AWS::EC2::AvailabilityZone::Name"
    },
    "subnet2AZ": {
      "Description": "Subnet 2 availability zone.",
      "Type": "AWS::EC2::AvailabilityZone::Name"
    }
 
   },
 
  "Resources": {
    "vpc": {
      "Type": "AWS::EC2::VPC",
      "Properties": {
        "CidrBlock": {"Ref": "vpcCidr"},
        "InstanceTenancy": "default",
        "EnableDnsSupport": "true",
        "EnableDnsHostnames": "true",
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "VPC"]]}
          }
        ]
      }
    },
    "publicSubnet1": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "publicSubnet1Cidr"},
        "AvailabilityZone": {"Ref" : "subnet1AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Public-1"]]}
          }
        ]
      }
    },
 
    "publicSubnet2": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "publicSubnet2Cidr"},
        "AvailabilityZone": {"Ref" : "subnet2AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Public-2"]]}
          }
        ]
      }
    },
"publicSubnet3": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "publicSubnet3Cidr"},
        "AvailabilityZone": {"Ref" : "subnet1AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Public-3"]]}
          }
        ]
      }
    },

"publicSubnet4": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "publicSubnet4Cidr"},
        "AvailabilityZone": {"Ref" : "subnet2AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Public-4"]]}
          }
        ]
      }
    },

"privateSubnet1": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet1Cidr"},
        "AvailabilityZone": {"Ref" : "subnet1AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-1"]]}
          }
        ]
      }
    },

    "privateSubnet2": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet2Cidr"},
        "AvailabilityZone": {"Ref" : "subnet2AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-2"]]}
          }
        ]
      }
    },

"privateSubnet3": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet3Cidr"},
        "AvailabilityZone": {"Ref" : "subnet1AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-3"]]}
          }
        ]
      }
    },

"privateSubnet4": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet4Cidr"},
        "AvailabilityZone": {"Ref" : "subnet2AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-4"]]}
          }
        ]
      }
    },

"privateSubnet5": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet5Cidr"},
        "AvailabilityZone": {"Ref" : "subnet1AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-5"]]}
          }
        ]
      }
    },

"privateSubnet6": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet6Cidr"},
        "AvailabilityZone": {"Ref" : "subnet2AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-6"]]}
          }
        ]
      }
    },

"privateSubnet7": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet7Cidr"},
        "AvailabilityZone": {"Ref" : "subnet1AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-7"]]}
          }
        ]
      }
    },
"privateSubnet8": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet8Cidr"},
        "AvailabilityZone": {"Ref" : "subnet2AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-8"]]}
          }
        ]
      }
    },

"privateSubnet9": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet9Cidr"},
        "AvailabilityZone": {"Ref" : "subnet1AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-9"]]}
          }
        ]
      }
    },

"privateSubnet10": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet10Cidr"},
        "AvailabilityZone": {"Ref" : "subnet2AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-10"]]}
          }
        ]
      }
    },

"privateSubnet11": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet11Cidr"},
        "AvailabilityZone": {"Ref" : "subnet1AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-11"]]}
          }
        ]
      }
    },

"privateSubnet12": {
      "Type": "AWS::EC2::Subnet",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "CidrBlock": {"Ref": "privateSubnet12Cidr"},
        "AvailabilityZone": {"Ref" : "subnet2AZ"},
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "Subnet-Private-12"]]}
          }
        ]
      }
    },

    "inetGateway": {
      "Type": "AWS::EC2::InternetGateway",
      "DependsOn": ["vpc"],
      "Properties": {
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "InternetGateway"]]}
          }
        ]
      }
    },
    "attachGateway": {
      "Type": "AWS::EC2::VPCGatewayAttachment",
      "DependsOn": ["vpc", "inetGateway"],
      "Properties": {
        "VpcId": {"Ref": "vpc"},
        "InternetGatewayId": {"Ref": "inetGateway"}
      }
    },
    "rtbPublic": {
      "Type": "AWS::EC2::RouteTable",
      "DependsOn": ["vpc", "attachGateway"],
      "Properties": {
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "RTB-Public"]]}
          }
        ]
      }
    },
    "routePublic": {
      "Type": "AWS::EC2::Route",
      "DependsOn": ["rtbPublic"],
      "Properties": {
        "DestinationCidrBlock": "0.0.0.0/0",
        "RouteTableId": {"Ref": "rtbPublic"},
        "GatewayId": {"Ref": "inetGateway"}
      }
 
    },
    "subnetRouteTableAssociationPublic1": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "publicSubnet1"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPublic"},
        "SubnetId": {"Ref": "publicSubnet1"}
      }
    },
    "subnetRouteTableAssociationPublic2": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "publicSubnet2"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPublic"},
        "SubnetId": {"Ref": "publicSubnet2"}
      }
    },
"subnetRouteTableAssociationPublic3": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "publicSubnet3"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPublic"},
        "SubnetId": {"Ref": "publicSubnet3"}
      }
    },
"subnetRouteTableAssociationPublic4": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "publicSubnet4"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPublic"},
        "SubnetId": {"Ref": "publicSubnet4"}
      }
    },
    "rtbPrivate": {
      "Type": "AWS::EC2::RouteTable",
      "DependsOn": ["vpc"],
      "Properties": {
        "VpcId": {"Ref": "vpc"},
        "Tags": [
          {
            "Key": "Name",
            "Value": {"Fn::Join" : ["-", [{"Ref" : "envPrefix"}, "RTB-Private"]]}
          }
        ]
      }
    },
    "subnetRouteTableAssociationPrivate1": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet1"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet1"}
      }
    },
    "subnetRouteTableAssociationPrivate2": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet2"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet2"}
      }
    },
"subnetRouteTableAssociationPrivate3": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet3"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet3"}
      }
    },
"subnetRouteTableAssociationPrivate4": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet4"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet4"}
      }
    },
"subnetRouteTableAssociationPrivate5": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet5"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet5"}
      }
    },
"subnetRouteTableAssociationPrivate6": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet6"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet6"}
      }
    },
"subnetRouteTableAssociationPrivate7": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet7"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet7"}
      }
    },
"subnetRouteTableAssociationPrivate8": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet8"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet8"}
      }
    },
"subnetRouteTableAssociationPrivate9": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet9"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet9"}
      }
    },
"subnetRouteTableAssociationPrivate10": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet10"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet10"}
      }
    },
"subnetRouteTableAssociationPrivate11": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet11"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet11"}
      }
    },
"subnetRouteTableAssociationPrivate12": {
      "Type": "AWS::EC2::SubnetRouteTableAssociation",
      "DependsOn": ["rtbPublic", "privateSubnet12"],
      "Properties": {
        "RouteTableId": {"Ref": "rtbPrivate"},
        "SubnetId": {"Ref": "privateSubnet12"}
      }
    },
    "NAT" : {
  "DependsOn" : "rtbPrivate",
  "Type" : "AWS::EC2::NatGateway",
  "Properties" : {
    "AllocationId" : { "Fn::GetAtt" : ["EIP", "AllocationId"]},
    "SubnetId" : { "Ref" : "publicSubnet1"}
  }
},
"EIP" : {
  "Type" : "AWS::EC2::EIP",
  "Properties" : {
    "Domain" : "vpc"
  }
},
"routePrivate" : {
  "Type" : "AWS::EC2::Route",
  "DependsOn": ["rtbPrivate"],
  "Properties" : {
    "RouteTableId" : { "Ref" : "rtbPrivate" },
    "DestinationCidrBlock" : "0.0.0.0/0",
    "NatGatewayId" : { "Ref" : "NAT" }
  }
}
 

  }

}