Skip to content

Instantly share code, notes, and snippets.

@dearing
Last active January 11, 2016 15:37
Show Gist options
  • Select an option

  • Save dearing/2c8fe24f70b3b1dc90f8 to your computer and use it in GitHub Desktop.

Select an option

Save dearing/2c8fe24f70b3b1dc90f8 to your computer and use it in GitHub Desktop.

Revisions

  1. dearing revised this gist Jan 11, 2016. 1 changed file with 36 additions and 0 deletions.
    36 changes: 36 additions & 0 deletions sandbox.template
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,42 @@
    "Description": "Simple Sandbox VPC // NO NAT",

    "Metadata": {

    "Notes" : {

    "[ Parameters ]:" : "===================================================================================================================================",

    "ParameterEnvironment" : "What's in a name? This template will refrence this value for tagging purposes.",

    "[ Mappings ]:" : "====================================================================================================================================",

    "NetworkCIDRs" : "Easy customize the VPC CIDRs. The defined default allows for the following:",
    "VPC" : "172.21.0.0/22 HostMin: 172.21.0.1 , HostMax: 172.21.3.254 // 1022 Total Hosts",
    "EXT1" : "172.21.0.0/24 HostMin: 172.21.0.1 , HostMax: 172.21.0.254 // 254 total hosts",
    "EXT2" : "172.21.1.0/24 HostMin: 172.21.1.1 , HostMax: 172.21.1.254 // 254 total hosts",
    "INT1" : "172.21.2.0/24 HostMin: 172.21.2.1 , HostMax: 172.21.2.254 // 254 total hosts",
    "INT2" : "172.21.3.0/24 HostMin: 172.21.3.1 , HostMax: 172.21.3.254 // 254 total hosts",

    "[ Resources ]:" : "====================================================================================================================================",

    "InternetGateway" : "The [InternetGateway] gets attacted to the VPC to allow network trafic to the internet.",
    "Route" : "A route we define as 0.0.0.0/0 (everywhere) to forward to our [InternetGateway].",
    "RouteTableEXT1" : "A route-table we define and asscociate with [SubnetEXT1].",
    "RouteTableINT1" : "A route-table we define and asscociate with [SubnetINT1].",
    "RouteTableINT2" : "A route-table we define and asscociate with [SubnetINT2].",
    "SubnetEXT1" : "This subnet is created for the chosen from the returned 1st name a call to AWS::Region's AvailabilityZones (should equal INT1)",
    "SubnetEXT2" : "This subnet is created for the chosen from the returned 2nd name a call to AWS::Region's AvailabilityZones (should equal INT2)",
    "SubnetINT1" : "This subnet is created for the chosen from the returned 1st name a call to AWS::Region's AvailabilityZones (should equal EXT1)",
    "SubnetINT2" : "This subnet is created for the chosen from the returned 2nd name a call to AWS::Region's AvailabilityZones (should equal EXT2)",
    "SubnetRouteTableAssociationEXT1" : "Wire up [SubnetEXT1] with a refrence to route-table [RouteTableEXT1].",
    "SubnetRouteTableAssociationEXT2" : "Wire up [SubnetEXT2] with a refrence to route-table [RouteTableEXT1] (not a typo).",
    "SubnetRouteTableAssociationINT1" : "Wire up [SubnetINT1] with a refrence to route-table [RouteTableINT1].",
    "SubnetRouteTableAssociationINT2" : "Wire up [SubnetINT2] with a refrence to route-table [RouteTableINT2].",
    "VPC" : "Best to tag it with short name for easy console visibility. Here the tag `Name` refrences the parameter `ParameterEnvironment`.",
    "VPCGatewayAttachment" : "With [InternetGateway] defined, we attach it to the VPC we define, [VPC]"

    },

    "AWS::CloudFormation::Interface": {
    "ParameterGroups": [
    {
  2. dearing revised this gist Jan 11, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion sandbox.template
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    {
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Environment VPC Sandbox // NO NAT",
    "Description": "Simple Sandbox VPC // NO NAT",

    "Metadata": {
    "AWS::CloudFormation::Interface": {
    @@ -71,5 +71,6 @@
    },

    "Outputs": {

    }
    }
  3. dearing created this gist Jan 11, 2016.
    75 changes: 75 additions & 0 deletions sandbox.template
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,75 @@
    {
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Environment VPC Sandbox // NO NAT",

    "Metadata": {
    "AWS::CloudFormation::Interface": {
    "ParameterGroups": [
    {
    "Label": {
    "default": "Environment VPC"
    },
    "Parameters": [
    "ParameterEnvironment"
    ]
    }
    ],
    "ParameterLabels": {
    "ParameterEnvironment": {
    "default": "Environment VPC Name"
    }
    }
    }
    },

    "Parameters": {

    "ParameterEnvironment": {
    "AllowedPattern" : "[a-zA-Z0-9]*",
    "ConstraintDescription": "Must parse by `[a-zA-Z0-9]*`",
    "Default" : "Sandbox",
    "Description": "Create a unique name to identify this environment by.",
    "MaxLength" : "16",
    "MinLength" : "3",
    "Type": "String"
    }

    },

    "Conditions" : {},

    "Mappings": {

    "NetworkCIDRs": {
    "VPC": { "CIDR": "172.21.0.0/22" },
    "EXT1": { "CIDR": "172.21.0.0/24" },
    "EXT2": { "CIDR": "172.21.1.0/24" },
    "INT1": { "CIDR": "172.21.2.0/24" },
    "INT2": { "CIDR": "172.21.3.0/24" }
    }

    },

    "Resources": {

    "InternetGateway" : {"Type":"AWS::EC2::InternetGateway","Properties":{"Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":"InternetGateway"}]}},
    "Route" : {"Type":"AWS::EC2::Route","Properties":{"RouteTableId":{"Ref":"RouteTableEXT1"},"DestinationCidrBlock":"0.0.0.0/0","GatewayId":{"Ref":"InternetGateway"}}},
    "RouteTableEXT1" : {"Type":"AWS::EC2::RouteTable","Properties":{"VpcId":{"Ref":"VPC"},"Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":"RouteTableEXT1"}]}},
    "RouteTableINT1" : {"Type":"AWS::EC2::RouteTable","Properties":{"VpcId":{"Ref":"VPC"},"Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":"RouteTableINT1"}]}},
    "RouteTableINT2" : {"Type":"AWS::EC2::RouteTable","Properties":{"VpcId":{"Ref":"VPC"},"Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":"RouteTableINT2"}]}},
    "SubnetEXT1" : {"Type":"AWS::EC2::Subnet","Properties":{"VpcId":{"Ref":"VPC"},"AvailabilityZone":{"Fn::Select":["1",{"Fn::GetAZs":{"Ref":"AWS::Region"}}]},"CidrBlock":{"Fn::FindInMap":["NetworkCIDRs","EXT1","CIDR"]},"MapPublicIpOnLaunch":"True" ,"Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":"SubnetEXT1"}]}},
    "SubnetEXT2" : {"Type":"AWS::EC2::Subnet","Properties":{"VpcId":{"Ref":"VPC"},"AvailabilityZone":{"Fn::Select":["2",{"Fn::GetAZs":{"Ref":"AWS::Region"}}]},"CidrBlock":{"Fn::FindInMap":["NetworkCIDRs","EXT2","CIDR"]},"MapPublicIpOnLaunch":"True" ,"Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":"SubnetEXT2"}]}},
    "SubnetINT1" : {"Type":"AWS::EC2::Subnet","Properties":{"VpcId":{"Ref":"VPC"},"AvailabilityZone":{"Fn::Select":["1",{"Fn::GetAZs":{"Ref":"AWS::Region"}}]},"CidrBlock":{"Fn::FindInMap":["NetworkCIDRs","INT1","CIDR"]},"MapPublicIpOnLaunch":"False","Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":"SubnetINT1"}]}},
    "SubnetINT2" : {"Type":"AWS::EC2::Subnet","Properties":{"VpcId":{"Ref":"VPC"},"AvailabilityZone":{"Fn::Select":["2",{"Fn::GetAZs":{"Ref":"AWS::Region"}}]},"CidrBlock":{"Fn::FindInMap":["NetworkCIDRs","INT2","CIDR"]},"MapPublicIpOnLaunch":"False","Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":"SubnetINT2"}]}},
    "SubnetRouteTableAssociationEXT1" : {"Type":"AWS::EC2::SubnetRouteTableAssociation","Properties":{"SubnetId":{"Ref":"SubnetEXT1"},"RouteTableId":{"Ref":"RouteTableEXT1"}}},
    "SubnetRouteTableAssociationEXT2" : {"Type":"AWS::EC2::SubnetRouteTableAssociation","Properties":{"SubnetId":{"Ref":"SubnetEXT2"},"RouteTableId":{"Ref":"RouteTableEXT1"}}},
    "SubnetRouteTableAssociationINT1" : {"Type":"AWS::EC2::SubnetRouteTableAssociation","Properties":{"SubnetId":{"Ref":"SubnetINT1"},"RouteTableId":{"Ref":"RouteTableINT1"}}},
    "SubnetRouteTableAssociationINT2" : {"Type":"AWS::EC2::SubnetRouteTableAssociation","Properties":{"SubnetId":{"Ref":"SubnetINT2"},"RouteTableId":{"Ref":"RouteTableINT2"}}},
    "VPC" : {"Type":"AWS::EC2::VPC","Properties":{"CidrBlock":{"Fn::FindInMap":["NetworkCIDRs","VPC","CIDR"]},"EnableDnsSupport":"True","EnableDnsHostnames":"True","InstanceTenancy":"default","Tags":[{"Key":"ServiceProvider","Value":"Rackspace"},{"Key":"VPC","Value":{ "Ref" : "ParameterEnvironment" }},{"Key":"Name","Value":{ "Ref" : "ParameterEnvironment" }}]}},
    "VPCGatewayAttachment" : {"Type":"AWS::EC2::VPCGatewayAttachment","Properties":{"InternetGatewayId":{"Ref":"InternetGateway"},"VpcId":{"Ref":"VPC"}}}

    },

    "Outputs": {
    }
    }