Last active
October 5, 2017 07:05
-
-
Save andreaswasita/46c5b3d5a1581a4b8f1f to your computer and use it in GitHub Desktop.
Lab_MainVPCStack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "Builds a VPC w/ INET Gateway and 3 public subnets. **WARNING** This template creates Amazon EC2 instance(s). You will be billed for the AWS resources used if you create a stack from this template.", | |
"Resources" : { | |
"VPC" : { | |
"Type" : "AWS::EC2::VPC", | |
"Properties" : { | |
"CidrBlock" : "192.168.0.0/16", | |
"Tags" : [ | |
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} }, | |
{"Key" : "Network", "Value" : "Public" } | |
] | |
} | |
}, | |
"PublicSubnetA" : { | |
"Type" : "AWS::EC2::Subnet", | |
"Properties" : { | |
"VpcId" : { "Ref" : "VPC" }, | |
"CidrBlock" : "192.168.10.0/24", | |
"AvailabilityZone" : { "Fn::Select": [ "0", {"Fn::GetAZs": {"Ref": "AWS::Region"}} ]}, | |
"Tags" : [ | |
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} }, | |
{"Key" : "Network", "Value" : "Public" } | |
] | |
} | |
}, | |
"PublicSubnetB" : { | |
"Type" : "AWS::EC2::Subnet", | |
"Properties" : { | |
"VpcId" : { "Ref" : "VPC" }, | |
"CidrBlock" : "192.168.11.0/24", | |
"AvailabilityZone" : { "Fn::Select": [ "1", {"Fn::GetAZs": {"Ref": "AWS::Region"}} ]}, | |
"Tags" : [ | |
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} }, | |
{"Key" : "Network", "Value" : "Public" } | |
] | |
} | |
}, | |
"PublicSubnetC" : { | |
"Type" : "AWS::EC2::Subnet", | |
"Properties" : { | |
"VpcId" : { "Ref" : "VPC" }, | |
"CidrBlock" : "192.168.12.0/24", | |
"AvailabilityZone" : { "Fn::Select": [ "2", {"Fn::GetAZs": {"Ref": "AWS::Region"}} ]}, | |
"Tags" : [ | |
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} }, | |
{"Key" : "Network", "Value" : "Public" } | |
] | |
} | |
}, | |
"InternetGateway" : { | |
"Type" : "AWS::EC2::InternetGateway", | |
"Properties" : { | |
"Tags" : [ | |
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} }, | |
{"Key" : "Network", "Value" : "Public" } | |
] | |
} | |
}, | |
"AttachGateway" : { | |
"Type" : "AWS::EC2::VPCGatewayAttachment", | |
"Properties" : { | |
"VpcId" : { "Ref" : "VPC" }, | |
"InternetGatewayId" : { "Ref" : "InternetGateway" } | |
} | |
}, | |
"PublicRouteTable" : { | |
"Type" : "AWS::EC2::RouteTable", | |
"Properties" : { | |
"VpcId" : {"Ref" : "VPC"}, | |
"Tags" : [ | |
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} }, | |
{"Key" : "Network", "Value" : "Public" } | |
] | |
} | |
}, | |
"PublicRoute" : { | |
"Type" : "AWS::EC2::Route", | |
"Properties" : { | |
"RouteTableId" : { "Ref" : "PublicRouteTable" }, | |
"DestinationCidrBlock" : "0.0.0.0/0", | |
"GatewayId" : { "Ref" : "InternetGateway" } | |
} | |
}, | |
"PublicSubnetRouteTableAssociationA" : { | |
"Type" : "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties" : { | |
"SubnetId" : { "Ref" : "PublicSubnetA" }, | |
"RouteTableId" : { "Ref" : "PublicRouteTable" } | |
} | |
}, | |
"PublicSubnetRouteTableAssociationB" : { | |
"Type" : "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties" : { | |
"SubnetId" : { "Ref" : "PublicSubnetB" }, | |
"RouteTableId" : { "Ref" : "PublicRouteTable" } | |
} | |
}, | |
"PublicSubnetRouteTableAssociationC" : { | |
"Type" : "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties" : { | |
"SubnetId" : { "Ref" : "PublicSubnetC" }, | |
"RouteTableId" : { "Ref" : "PublicRouteTable" } | |
} | |
} | |
}, | |
"Outputs" : { | |
"VpcId" : { | |
"Value" : {"Ref" : "VPC"}, | |
"Description" : "VPC ID of newly created VPC" | |
}, | |
"PublicSubnetA" : { | |
"Value" : {"Ref" : "PublicSubnetA"}, | |
"Description" : "Public Subnet in AZ A" | |
}, | |
"PublicSubnetB" : { | |
"Value" : {"Ref" : "PublicSubnetB"}, | |
"Description" : "Public Subnet in AZ B" | |
}, | |
"PublicSubnetC" : { | |
"Value" : {"Ref" : "PublicSubnetC"}, | |
"Description" : "Public Subnet in AZ C" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment