Last active
February 11, 2017 17:52
-
-
Save Noppy/8ddc8fb0ca653eb0e4bcfecd26daf136 to your computer and use it in GitHub Desktop.
This file contains 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", | |
"Resources": { | |
"MainVPC": { | |
"Type": "AWS::EC2::VPC", | |
"Properties": { | |
"CidrBlock": "10.0.0.0/16", | |
"EnableDnsSupport": "true", | |
"EnableDnsHostnames": "true", | |
"InstanceTenancy": "default", | |
"Tags": [ | |
{ | |
"Key" : "Application", | |
"Value" : { "Ref" : "AWS::StackName"} | |
} | |
] | |
} | |
}, | |
"InetGW": { | |
"Type": "AWS::EC2::InternetGateway", | |
"Properties": { | |
"Tags" : [ | |
{ | |
"Key" : "Application", | |
"Value" : { "Ref" : "AWS::StackName"} | |
} | |
] | |
}, | |
"DependsOn": [ | |
"MainVPC" | |
] | |
}, | |
"AttachInetGW": { | |
"Type": "AWS::EC2::VPCGatewayAttachment", | |
"Properties": { | |
"InternetGatewayId": { | |
"Ref": "InetGW" | |
}, | |
"VpcId": { | |
"Ref": "MainVPC" | |
} | |
}, | |
"DependsOn": [ | |
"MainVPC", | |
"InetGW" | |
] | |
}, | |
"PubAsub": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"VpcId": { | |
"Ref": "MainVPC" | |
}, | |
"CidrBlock": "10.0.1.0/24", | |
"AvailabilityZone": { | |
"Fn::Select": [ | |
"0", | |
{ | |
"Fn::GetAZs": { | |
"Ref": "AWS::Region" | |
} | |
} | |
] | |
}, | |
"Tags": [ | |
{ | |
"Key" : "Application", | |
"Value" : { "Ref" : "AWS::StackName"} | |
}, | |
{ | |
"Key" : "Network", | |
"Value" : "Public" | |
} | |
] | |
}, | |
"DependsOn": [ | |
"MainVPC" | |
] | |
}, | |
"PubBsub": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"VpcId": { | |
"Ref": "MainVPC" | |
}, | |
"CidrBlock": "10.0.2.0/24", | |
"AvailabilityZone": { | |
"Fn::Select": [ | |
"1", | |
{ | |
"Fn::GetAZs": { | |
"Ref": "AWS::Region" | |
} | |
} | |
] | |
}, | |
"Tags": [ | |
{ | |
"Key" : "Application", | |
"Value" : { "Ref" : "AWS::StackName"} | |
}, | |
{ | |
"Key" : "Network", | |
"Value" : "Public" | |
} | |
] | |
}, | |
"DependsOn": [ | |
"MainVPC" | |
] | |
}, | |
"PrivateAsub": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"VpcId": { | |
"Ref": "MainVPC" | |
}, | |
"CidrBlock": "10.0.11.0/24", | |
"AvailabilityZone": { | |
"Fn::Select": [ | |
"0", | |
{ | |
"Fn::GetAZs": { | |
"Ref": "AWS::Region" | |
} | |
} | |
] | |
}, | |
"Tags": [ | |
{ | |
"Key" : "Application", | |
"Value" : { "Ref" : "AWS::StackName"} | |
}, | |
{ | |
"Key" : "Network", | |
"Value" : "Private" | |
} | |
] | |
}, | |
"DependsOn": [ | |
"MainVPC" | |
] | |
}, | |
"PrivateBsub": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"VpcId": { | |
"Ref": "MainVPC" | |
}, | |
"CidrBlock": "10.0.12.0/24", | |
"AvailabilityZone": { | |
"Fn::Select": [ | |
"1", | |
{ | |
"Fn::GetAZs": { | |
"Ref": "AWS::Region" | |
} | |
} | |
] | |
}, | |
"Tags": [ | |
{ | |
"Key" : "Application", | |
"Value" : { "Ref" : "AWS::StackName"} | |
}, | |
{ | |
"Key" : "Network", | |
"Value" : "Private" | |
} | |
] | |
}, | |
"DependsOn": [ | |
"MainVPC" | |
] | |
}, | |
"InternetRouteTable": { | |
"Type": "AWS::EC2::RouteTable", | |
"Properties": { | |
"VpcId": { | |
"Ref": "MainVPC" | |
}, | |
"Tags": [ | |
{ | |
"Key" : "Application", | |
"Value" : { "Ref" : "AWS::StackName"} | |
} | |
] | |
}, | |
"DependsOn": [ | |
"MainVPC" | |
] | |
}, | |
"InternetRote": { | |
"Type": "AWS::EC2::Route", | |
"Properties": { | |
"RouteTableId": { | |
"Ref": "InternetRouteTable" | |
}, | |
"DestinationCidrBlock" : "0.0.0.0/0", | |
"GatewayId": { | |
"Ref": "InetGW" | |
} | |
}, | |
"DependsOn": [ | |
"AttachInetGW" | |
] | |
}, | |
"PubSubRouteTableAssociationA" : { | |
"Type" : "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties" : { | |
"SubnetId" : { "Ref" : "PubAsub" }, | |
"RouteTableId" : { "Ref" : "InternetRouteTable" } | |
} | |
}, | |
"PubSubRouteTableAssociationB" : { | |
"Type" : "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties" : { | |
"SubnetId" : { "Ref" : "PubBsub" }, | |
"RouteTableId" : { "Ref" : "InternetRouteTable" } | |
} | |
}, | |
"WebSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"VpcId": { | |
"Ref": "MainVPC" | |
}, | |
"GroupDescription": "Allow access from HTTP and HTTPS traffic", | |
"SecurityGroupIngress": [ | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "80", | |
"ToPort": "80", | |
"CidrIp": "0.0.0.0/0" | |
}, | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "443", | |
"ToPort": "443", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
}, | |
"DependsOn": [ | |
"MainVPC" | |
] | |
}, | |
"SSHSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"VpcId": { | |
"Ref": "MainVPC" | |
}, | |
"GroupDescription": "Allow access from SSH traffic", | |
"SecurityGroupIngress": [ | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "22", | |
"ToPort": "22", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
}, | |
"DependsOn": [ | |
"MainVPC" | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment