{
"AWSTemplateFormatVersion": "2010-09-09", "Description": "AWS CloudFormation Sample Template.", "Parameters" : { "AZ1" : { "Default" : "ap-northeast-1a", "Description" : "AZ", "Type" : "String", "AllowedValues" : [ "ap-northeast-1a","ap-northeast-1c","us-west-2a","us-west-2b","us-west-2c","us-east-1a","us-east-1b","us-east-1c","us-east-1d","us-east-1e" ], "ConstraintDescription" : "must select a valid availability zone." } }, "Mappings": { "SubnetConfig": { "VPC": { "CIDR": "10.0.0.0/16" }, "Public": { "CIDR": "10.0.0.0/24" }, "Private": { "CIDR": "10.0.1.0/24" } } }, "Resources": { "VPC": { "Type": "AWS::EC2::VPC", "Properties": { "CidrBlock": { "Fn::FindInMap": [ "SubnetConfig", "VPC", "CIDR" ] }, "Tags": [ { "Key": "Application", "Value": { "Ref": "AWS::StackId" } }, { "Key": "Network", "Value": "Public" } ] }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "36f558fe-7a2b-4a24-9edb-3b9a10d33217" } } }, "PublicSubnet": { "Type": "AWS::EC2::Subnet", "Properties": { "VpcId": { "Ref": "VPC" }, "CidrBlock": { "Fn::FindInMap": [ "SubnetConfig", "Public", "CIDR" ] }, "AvailabilityZone": {"Ref": "AZ1"}, "Tags": [ { "Key": "Application", "Value": { "Ref": "AWS::StackId" } }, { "Key": "Network", "Value": "Public" } ] }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "d17f3169-9687-4907-ac33-04ce215fded7" } } }, "InternetGateway": { "Type": "AWS::EC2::InternetGateway", "Properties": { "Tags": [ { "Key": "Application", "Value": { "Ref": "AWS::StackId" } }, { "Key": "Network", "Value": "Public" } ] }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "7354dd3a-e180-418e-8cd2-a9b2ad2a4666" } } }, "GatewayToInternet": { "Type": "AWS::EC2::VPCGatewayAttachment", "Properties": { "VpcId": { "Ref": "VPC" }, "InternetGatewayId": { "Ref": "InternetGateway" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "92a83719-48bf-4e04-a3cd-0f8b99305053" } } }, "PublicRouteTable": { "Type": "AWS::EC2::RouteTable", "Properties": { "VpcId": { "Ref": "VPC" }, "Tags": [ { "Key": "Application", "Value": { "Ref": "AWS::StackId" } }, { "Key": "Network", "Value": "Public" } ] }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "35457506-b697-467e-925b-61a48305e0da" } } }, "PublicRoute": { "Type": "AWS::EC2::Route", "DependsOn": "GatewayToInternet", "Properties": { "RouteTableId": { "Ref": "PublicRouteTable" }, "DestinationCidrBlock": "0.0.0.0/0", "GatewayId": { "Ref": "InternetGateway" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "3b3697f1-2874-4073-847a-c2814e9c4336" } } }, "PublicSubnetRouteTableAssociation": { "Type": "AWS::EC2::SubnetRouteTableAssociation", "Properties": { "SubnetId": { "Ref": "PublicSubnet" }, "RouteTableId": { "Ref": "PublicRouteTable" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "6033dd6a-6b5b-4b0a-9e41-a59a779c5a61" } } }, "PublicNetworkAcl": { "Type": "AWS::EC2::NetworkAcl", "Properties": { "VpcId": { "Ref": "VPC" }, "Tags": [ { "Key": "Application", "Value": { "Ref": "AWS::StackId" } }, { "Key": "Network", "Value": "Public" } ] }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "9d9f7c73-1580-4f8e-8463-6e27fb43e766" } } }, "InboundHTTPPublicNetworkAclEntry": { "Type": "AWS::EC2::NetworkAclEntry", "Properties": { "NetworkAclId": { "Ref": "PublicNetworkAcl" }, "RuleNumber": "100", "Protocol": "6", "RuleAction": "allow", "Egress": "false", "CidrBlock": "0.0.0.0/0", "PortRange": { "From": "80", "To": "80" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "fc400079-4e29-449d-9261-802c07e90664" } } }, "InboundHTTPSPublicNetworkAclEntry": { "Type": "AWS::EC2::NetworkAclEntry", "Properties": { "NetworkAclId": { "Ref": "PublicNetworkAcl" }, "RuleNumber": "101", "Protocol": "6", "RuleAction": "allow", "Egress": "false", "CidrBlock": "0.0.0.0/0", "PortRange": { "From": "443", "To": "443" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "8b8f955d-4b13-43ad-bd92-88a983aba05e" } } }, "InboundSSHPublicNetworkAclEntry": { "Type": "AWS::EC2::NetworkAclEntry", "Properties": { "NetworkAclId": { "Ref": "PublicNetworkAcl" }, "RuleNumber": "102", "Protocol": "6", "RuleAction": "allow", "Egress": "false", "CidrBlock": "0.0.0.0/0", "PortRange": { "From": "22", "To": "22" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "c8ec5a7a-62cb-4406-9f2d-0b5a564fd966" } } }, "InboundEphemeralPublicNetworkAclEntry": { "Type": "AWS::EC2::NetworkAclEntry", "Properties": { "NetworkAclId": { "Ref": "PublicNetworkAcl" }, "RuleNumber": "103", "Protocol": "6", "RuleAction": "allow", "Egress": "false", "CidrBlock": "0.0.0.0/0", "PortRange": { "From": "1024", "To": "65535" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "f22aa599-4f7e-4715-a098-41e10c081523" } } }, "OutboundPublicNetworkAclEntry": { "Type": "AWS::EC2::NetworkAclEntry", "Properties": { "NetworkAclId": { "Ref": "PublicNetworkAcl" }, "RuleNumber": "100", "Protocol": "6", "RuleAction": "allow", "Egress": "true", "CidrBlock": "0.0.0.0/0", "PortRange": { "From": "0", "To": "65535" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "6a00b44b-c40f-4464-aad5-1d54e3772398" } } }, "PublicSubnetNetworkAclAssociation": { "Type": "AWS::EC2::SubnetNetworkAclAssociation", "Properties": { "SubnetId": { "Ref": "PublicSubnet" }, "NetworkAclId": { "Ref": "PublicNetworkAcl" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "de86ddc8-8415-41a5-a905-b1bda5ba3fed" } } }, "PrivateSubnet": { "Type": "AWS::EC2::Subnet", "Properties": { "VpcId": { "Ref": "VPC" }, "CidrBlock": { "Fn::FindInMap": [ "SubnetConfig", "Private", "CIDR" ] }, "AvailabilityZone": {"Ref": "AZ1"}, "Tags": [ { "Key": "Application", "Value": { "Ref": "AWS::StackId" } }, { "Key": "Network", "Value": "Private" } ] }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "c88e3060-c887-4c7a-8b25-74dba8c01b1f" } } }, "PrivateRouteTable": { "Type": "AWS::EC2::RouteTable", "Properties": { "VpcId": { "Ref": "VPC" }, "Tags": [ { "Key": "Application", "Value": { "Ref": "AWS::StackId" } }, { "Key": "Network", "Value": "Private" } ] }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "e13eddcb-d508-41ed-86ba-52721609f64d" } } }, "PrivateSubnetRouteTableAssociation": { "Type": "AWS::EC2::SubnetRouteTableAssociation", "Properties": { "SubnetId": { "Ref": "PrivateSubnet" }, "RouteTableId": { "Ref": "PrivateRouteTable" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "6459bdbb-c25c-4bd7-9ea6-e78fc7da90d0" } } }, "PrivateNetworkAcl": { "Type": "AWS::EC2::NetworkAcl", "Properties": { "VpcId": { "Ref": "VPC" }, "Tags": [ { "Key": "Application", "Value": { "Ref": "AWS::StackId" } }, { "Key": "Network", "Value": "Private" } ] }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "5f563655-d27c-492d-9458-8b36dd950a7e" } } }, "InboundPrivateNetworkAclEntry": { "Type": "AWS::EC2::NetworkAclEntry", "Properties": { "NetworkAclId": { "Ref": "PrivateNetworkAcl" }, "RuleNumber": "100", "Protocol": "6", "RuleAction": "allow", "Egress": "false", "CidrBlock": "0.0.0.0/0", "PortRange": { "From": "0", "To": "65535" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "81a03e88-a76c-4335-be92-01c433e692cf" } } }, "OutBoundPrivateNetworkAclEntry": { "Type": "AWS::EC2::NetworkAclEntry", "Properties": { "NetworkAclId": { "Ref": "PrivateNetworkAcl" }, "RuleNumber": "100", "Protocol": "6", "RuleAction": "allow", "Egress": "true", "CidrBlock": "0.0.0.0/0", "PortRange": { "From": "0", "To": "65535" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "0d4bfe6f-ab3b-434a-bb71-6b0d7a74c1c8" } } }, "PrivateSubnetNetworkAclAssociation": { "Type": "AWS::EC2::SubnetNetworkAclAssociation", "Properties": { "SubnetId": { "Ref": "PrivateSubnet" }, "NetworkAclId": { "Ref": "PrivateNetworkAcl" } }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "c1a742ea-be11-4f90-9edb-00340f314443" } } } }, "Outputs": { "VPCID" : { "Value" : { "Ref" : "VPC" }, "Description" : "VPC ID" }, "SUBNETPUB1" : { "Value" : { "Ref" : "PublicSubnet" }, "Description" : "PublicSubnet1" }, "SUBNETPRI1" : { "Value" : { "Ref" : "PrivateSubnet" }, "Description" : "PrivateSubnet1" } }, "Metadata": { "AWS::CloudFormation::Designer": { "7354dd3a-e180-418e-8cd2-a9b2ad2a4666": { "size": { "width": 60, "height": 60 }, "position": { "x": 1250, "y": 190 }, "z": 1, "embeds": [] }, "36f558fe-7a2b-4a24-9edb-3b9a10d33217": { "size": { "width": 1120, "height": 670 }, "position": { "x": 60, "y": 90 }, "z": 1, "embeds": [ "5f563655-d27c-492d-9458-8b36dd950a7e", "c88e3060-c887-4c7a-8b25-74dba8c01b1f", "9d9f7c73-1580-4f8e-8463-6e27fb43e766", "35457506-b697-467e-925b-61a48305e0da", "d17f3169-9687-4907-ac33-04ce215fded7", "e13eddcb-d508-41ed-86ba-52721609f64d" ] }, "5f563655-d27c-492d-9458-8b36dd950a7e": { "size": { "width": 420, "height": 240 }, "position": { "x": 80, "y": 490 }, "z": 2, "parent": "36f558fe-7a2b-4a24-9edb-3b9a10d33217", "embeds": [ "0d4bfe6f-ab3b-434a-bb71-6b0d7a74c1c8", "81a03e88-a76c-4335-be92-01c433e692cf" ] }, "0d4bfe6f-ab3b-434a-bb71-6b0d7a74c1c8": { "size": { "width": 60, "height": 60 }, "position": { "x": 110, "y": 550 }, "z": 3, "parent": "5f563655-d27c-492d-9458-8b36dd950a7e", "embeds": [] }, "81a03e88-a76c-4335-be92-01c433e692cf": { "size": { "width": 60, "height": 60 }, "position": { "x": 230, "y": 550 }, "z": 3, "parent": "5f563655-d27c-492d-9458-8b36dd950a7e", "embeds": [] }, "e13eddcb-d508-41ed-86ba-52721609f64d": { "size": { "width": 240, "height": 230 }, "position": { "x": 910, "y": 490 }, "z": 2, "parent": "36f558fe-7a2b-4a24-9edb-3b9a10d33217", "embeds": [] }, "c88e3060-c887-4c7a-8b25-74dba8c01b1f": { "size": { "width": 190, "height": 230 }, "position": { "x": 620, "y": 490 }, "z": 2, "parent": "36f558fe-7a2b-4a24-9edb-3b9a10d33217", "embeds": [] }, "c1a742ea-be11-4f90-9edb-00340f314443": { "source": { "id": "5f563655-d27c-492d-9458-8b36dd950a7e" }, "target": { "id": "c88e3060-c887-4c7a-8b25-74dba8c01b1f" }, "z": 2 }, "6459bdbb-c25c-4bd7-9ea6-e78fc7da90d0": { "source": { "id": "e13eddcb-d508-41ed-86ba-52721609f64d" }, "target": { "id": "c88e3060-c887-4c7a-8b25-74dba8c01b1f" }, "z": 2 }, "9d9f7c73-1580-4f8e-8463-6e27fb43e766": { "size": { "width": 420, "height": 330 }, "position": { "x": 80, "y": 130 }, "z": 2, "parent": "36f558fe-7a2b-4a24-9edb-3b9a10d33217", "embeds": [ "6a00b44b-c40f-4464-aad5-1d54e3772398", "f22aa599-4f7e-4715-a098-41e10c081523", "c8ec5a7a-62cb-4406-9f2d-0b5a564fd966", "8b8f955d-4b13-43ad-bd92-88a983aba05e", "fc400079-4e29-449d-9261-802c07e90664" ] }, "6a00b44b-c40f-4464-aad5-1d54e3772398": { "size": { "width": 60, "height": 60 }, "position": { "x": 110, "y": 190 }, "z": 3, "parent": "9d9f7c73-1580-4f8e-8463-6e27fb43e766", "embeds": [] }, "f22aa599-4f7e-4715-a098-41e10c081523": { "size": { "width": 60, "height": 60 }, "position": { "x": 230, "y": 190 }, "z": 3, "parent": "9d9f7c73-1580-4f8e-8463-6e27fb43e766", "embeds": [] }, "c8ec5a7a-62cb-4406-9f2d-0b5a564fd966": { "size": { "width": 60, "height": 60 }, "position": { "x": 110, "y": 310 }, "z": 3, "parent": "9d9f7c73-1580-4f8e-8463-6e27fb43e766", "embeds": [] }, "8b8f955d-4b13-43ad-bd92-88a983aba05e": { "size": { "width": 60, "height": 60 }, "position": { "x": 230, "y": 310 }, "z": 3, "parent": "9d9f7c73-1580-4f8e-8463-6e27fb43e766", "embeds": [] }, "fc400079-4e29-449d-9261-802c07e90664": { "size": { "width": 60, "height": 60 }, "position": { "x": 350, "y": 190 }, "z": 3, "parent": "9d9f7c73-1580-4f8e-8463-6e27fb43e766", "embeds": [] }, "35457506-b697-467e-925b-61a48305e0da": { "size": { "width": 240, "height": 240 }, "position": { "x": 910, "y": 180 }, "z": 2, "parent": "36f558fe-7a2b-4a24-9edb-3b9a10d33217", "embeds": [ "3b3697f1-2874-4073-847a-c2814e9c4336" ] }, "92a83719-48bf-4e04-a3cd-0f8b99305053": { "source": { "id": "7354dd3a-e180-418e-8cd2-a9b2ad2a4666" }, "target": { "id": "36f558fe-7a2b-4a24-9edb-3b9a10d33217" }, "z": 1 }, "3b3697f1-2874-4073-847a-c2814e9c4336": { "size": { "width": 60, "height": 60 }, "position": { "x": 940, "y": 240 }, "z": 3, "parent": "35457506-b697-467e-925b-61a48305e0da", "embeds": [], "references": [ "7354dd3a-e180-418e-8cd2-a9b2ad2a4666" ], "dependson": [ "92a83719-48bf-4e04-a3cd-0f8b99305053" ] }, "d17f3169-9687-4907-ac33-04ce215fded7": { "size": { "width": 200, "height": 230 }, "position": { "x": 610, "y": 180 }, "z": 2, "parent": "36f558fe-7a2b-4a24-9edb-3b9a10d33217", "embeds": [] }, "de86ddc8-8415-41a5-a905-b1bda5ba3fed": { "source": { "id": "9d9f7c73-1580-4f8e-8463-6e27fb43e766" }, "target": { "id": "d17f3169-9687-4907-ac33-04ce215fded7" }, "z": 2 }, "6033dd6a-6b5b-4b0a-9e41-a59a779c5a61": { "source": { "id": "35457506-b697-467e-925b-61a48305e0da" }, "target": { "id": "d17f3169-9687-4907-ac33-04ce215fded7" }, "z": 2 } } }
}