Skip to content

Instantly share code, notes, and snippets.

@knakayama
Created December 31, 2015 16:53
Show Gist options
  • Save knakayama/3c4c2759e03d72d196c3 to your computer and use it in GitHub Desktop.
Save knakayama/3c4c2759e03d72d196c3 to your computer and use it in GitHub Desktop.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "172.30.0.0/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
"Tags": [
{
"Key": "Name",
"Value": "Sample"
}
]
}
},
"SubnetTrustAZa": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "172.30.0.0/24",
"AvailabilityZone": "ap-northeast-1a",
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": "Trust-AZ-A"
}
]
}
},
"SubnetTrustAZc": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "172.30.1.0/24",
"AvailabilityZone": "ap-northeast-1c",
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": "Trust-AZ-C"
}
]
}
},
"SubnetDMZAZa": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "172.30.2.0/24",
"AvailabilityZone": "ap-northeast-1a",
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": "DMZ-AZ-A"
}
]
}
},
"SubnetDMZAZc": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "172.30.3.0/24",
"AvailabilityZone": "ap-northeast-1c",
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": "DMZ-AZ-C"
}
]
}
},
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "SampleVPC-Gateway"
}
]
}
},
"DHCPOptions": {
"Type": "AWS::EC2::DHCPOptions",
"Properties": {
"DomainName": "ap-northeast-1.compute.internal",
"DomainNameServers": [
"AmazonProvidedDNS"
]
}
},
"NetworkAcl": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"VpcId": {
"Ref": "VPC"
}
}
},
"RouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "VPC"
}
}
},
"SecurityGroupDefault": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "default VPC security group",
"VpcId": {
"Ref": "VPC"
},
"SecurityGroupEgress": [
{
"IpProtocol": "-1",
"CidrIp": "0.0.0.0/0"
}
]
}
},
"NetworkACLEntry1": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"CidrBlock": "0.0.0.0/0",
"Egress": "true",
"Protocol": "-1",
"RuleAction": "allow",
"RuleNumber": "100",
"NetworkAclId": {
"Ref": "NetworkAcl"
}
}
},
"NetworkACLEntry2": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"CidrBlock": "0.0.0.0/0",
"Egress": "true",
"Protocol": "-1",
"RuleAction": "allow",
"RuleNumber": "100",
"NetworkAclId": {
"Ref": "NetworkAcl"
}
}
},
"SubnetACL1": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "SubnetTrustAZa"
}
}
},
"SubnetACL2": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "SubnetTrustAZc"
}
}
},
"SubnetACL3": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "SubnetDMZAZa"
}
}
},
"SubnetACL4": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "SubnetDMZAZc"
}
}
},
"InternetGatewayAttach": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"InternetGatewayId": {
"Ref": "InternetGateway"
}
}
},
"DHCPOptionsAttach": {
"Type": "AWS::EC2::VPCDHCPOptionsAssociation",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"DhcpOptionsId": {
"Ref": "DHCPOptions"
}
}
},
"ingress1": {
"Type": "AWS::EC2::SecurityGroupIngress",
"Properties": {
"GroupId": {
"Ref": "SecurityGroupDefault"
},
"IpProtocol": "-1",
"SourceSecurityGroupId": {
"Ref": "SecurityGroupDefault"
}
}
},
"egress1": {
"Type": "AWS::EC2::SecurityGroupEgress",
"Properties": {
"GroupId": {
"Ref": "SecurityGroupDefault"
},
"IpProtocol": "-1",
"CidrIp": "0.0.0.0/0"
}
},
"route1": {
"Type": "AWS::EC2::Route",
"Properties": {
"DestinationCidrBlock": "0.0.0.0/0",
"RouteTableId": {
"Ref": "RouteTable"
},
"GatewayId": {
"Ref": "InternetGateway"
}
},
"DependsOn": "InternetGatewayAttach"
},
"subnetroute1": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "SubnetDMZAZa"
}
}
},
"subnetroute2": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "SubnetDMZAZc"
}
}
}
},
"Description": "SampleVPC"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment