Created
March 25, 2014 17:08
-
-
Save masayuki5160/9766475 to your computer and use it in GitHub Desktop.
Base VPC Formation.
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", | |
"Resources": { | |
"vpc626b7500": { | |
"Type": "AWS::EC2::VPC", | |
"Properties": { | |
"CidrBlock": "10.0.0.0/16", | |
"InstanceTenancy": "default", | |
"EnableDnsSupport": "true", | |
"EnableDnsHostnames": "true" | |
} | |
}, | |
"subnete0919394": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"CidrBlock": "10.0.0.0/24", | |
"AvailabilityZone": "ap-northeast-1a", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "PublicSubnet" | |
} | |
] | |
} | |
}, | |
"subnete7919393": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"CidrBlock": "10.0.1.0/24", | |
"AvailabilityZone": "ap-northeast-1a", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "ProtectedWebAppSubnet" | |
} | |
] | |
} | |
}, | |
"subnetb86644fe": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"CidrBlock": "10.0.3.0/24", | |
"AvailabilityZone": "ap-northeast-1c", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "PublicSubnet" | |
} | |
] | |
} | |
}, | |
"subneta39b99d7": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"CidrBlock": "10.0.2.0/24", | |
"AvailabilityZone": "ap-northeast-1a", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "ProtectedDatabaseSubnet" | |
} | |
] | |
} | |
}, | |
"subnet1a67455c": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"CidrBlock": "10.0.5.0/24", | |
"AvailabilityZone": "ap-northeast-1c", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "ProtectedDatabaseSubnet" | |
} | |
] | |
} | |
}, | |
"subnet7a67453c": { | |
"Type": "AWS::EC2::Subnet", | |
"Properties": { | |
"CidrBlock": "10.0.4.0/24", | |
"AvailabilityZone": "ap-northeast-1c", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "ProtectedWebAppSubnet" | |
} | |
] | |
} | |
}, | |
"igw5c41573e": { | |
"Type": "AWS::EC2::InternetGateway", | |
"Properties": { | |
} | |
}, | |
"dopt0aebe168": { | |
"Type": "AWS::EC2::DHCPOptions", | |
"Properties": { | |
"DomainName": "ap-northeast-1.compute.internal", | |
"DomainNameServers": [ | |
"AmazonProvidedDNS" | |
] | |
} | |
}, | |
"acl23594041": { | |
"Type": "AWS::EC2::NetworkAcl", | |
"Properties": { | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
} | |
} | |
}, | |
"rtb0f6a736d": { | |
"Type": "AWS::EC2::RouteTable", | |
"Properties": { | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "PublicRouteTable" | |
} | |
] | |
} | |
}, | |
"rtb0e6a736c": { | |
"Type": "AWS::EC2::RouteTable", | |
"Properties": { | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "ProtectedRouteTable" | |
} | |
] | |
} | |
}, | |
"elbELB": { | |
"Type": "AWS::ElasticLoadBalancing::LoadBalancer", | |
"Properties": { | |
"Subnets": [ | |
"subnet-e0919394" | |
], | |
"HealthCheck": { | |
"HealthyThreshold": "10", | |
"Interval": "30", | |
"Target": "HTTP:80/index.html", | |
"Timeout": "5", | |
"UnhealthyThreshold": "2" | |
}, | |
"Instances": [ | |
{ | |
"Ref": "instanceia0971ca6" | |
} | |
], | |
"SecurityGroups": [ | |
{ | |
"Ref": "sgPublicWebSecurityGroup" | |
} | |
], | |
"Listeners": [ | |
{ | |
"InstancePort": "80", | |
"LoadBalancerPort": "80", | |
"Protocol": "HTTP", | |
"InstanceProtocol": "HTTP" | |
} | |
] | |
} | |
}, | |
"eip54199236139": { | |
"Type": "AWS::EC2::EIP", | |
"DependsOn": "gw1", | |
"Properties": { | |
"Domain": "vpc", | |
"InstanceId": { | |
"Ref": "instanceib7800bb1" | |
} | |
} | |
}, | |
"eip54199164144": { | |
"Type": "AWS::EC2::EIP", | |
"DependsOn": "gw1", | |
"Properties": { | |
"Domain": "vpc", | |
"InstanceId": { | |
"Ref": "instanceia1001da7" | |
} | |
} | |
}, | |
"instanceib7800bb1": { | |
"Type": "AWS::EC2::Instance", | |
"Properties": { | |
"DisableApiTermination": "FALSE", | |
"ImageId": "ami-5f840e5e", | |
"InstanceType": "m1.small", | |
"KernelId": "aki-44992845", | |
"KeyName": "TestSAWebApp", | |
"Monitoring": "false", | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "NAT Server" | |
} | |
], | |
"NetworkInterfaces": [ | |
{ | |
"DeleteOnTermination": "true", | |
"DeviceIndex": 0, | |
"SubnetId": { | |
"Ref": "subnete0919394" | |
}, | |
"PrivateIpAddresses": [ | |
{ | |
"PrivateIpAddress": "10.0.0.230", | |
"Primary": "true" | |
} | |
], | |
"GroupSet": [ | |
{ | |
"Ref": "sgNATSecurityGroup" | |
}, | |
{ | |
"Ref": "sgVPCDefaultSecurityGroup" | |
} | |
] | |
} | |
] | |
} | |
}, | |
"instanceia0971ca6": { | |
"Type": "AWS::EC2::Instance", | |
"Properties": { | |
"DisableApiTermination": "FALSE", | |
"ImageId": "ami-0d13700c", | |
"InstanceType": "t1.micro", | |
"KernelId": "aki-176bf516", | |
"KeyName": "TestSAWebApp", | |
"Monitoring": "false", | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "ProtectedWebAppServer" | |
} | |
], | |
"NetworkInterfaces": [ | |
{ | |
"DeleteOnTermination": "true", | |
"Description": "Primary network interface", | |
"DeviceIndex": 0, | |
"SubnetId": { | |
"Ref": "subnete7919393" | |
}, | |
"PrivateIpAddresses": [ | |
{ | |
"PrivateIpAddress": "10.0.1.58", | |
"Primary": "true" | |
} | |
], | |
"GroupSet": [ | |
{ | |
"Ref": "sgApplicationSecurityGroup" | |
}, | |
{ | |
"Ref": "sgVPCDefaultSecurityGroup" | |
} | |
] | |
} | |
] | |
} | |
}, | |
"instanceia1001da7": { | |
"Type": "AWS::EC2::Instance", | |
"Properties": { | |
"DisableApiTermination": "FALSE", | |
"ImageId": "ami-0d13700c", | |
"InstanceType": "t1.micro", | |
"KernelId": "aki-176bf516", | |
"KeyName": "TestSAWebApp", | |
"Monitoring": "false", | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "BastionServer" | |
} | |
], | |
"NetworkInterfaces": [ | |
{ | |
"DeleteOnTermination": "true", | |
"Description": "Primary network interface", | |
"DeviceIndex": 0, | |
"SubnetId": { | |
"Ref": "subnetb86644fe" | |
}, | |
"PrivateIpAddresses": [ | |
{ | |
"PrivateIpAddress": "10.0.3.54", | |
"Primary": "true" | |
} | |
], | |
"GroupSet": [ | |
{ | |
"Ref": "sgVPCDefaultSecurityGroup" | |
}, | |
{ | |
"Ref": "sgSSHSecurityGroup" | |
} | |
] | |
} | |
] | |
} | |
}, | |
"volumevolcc73bec6": { | |
"Type": "AWS::EC2::Volume", | |
"Properties": { | |
"AvailabilityZone": "ap-northeast-1a", | |
"Size": "8", | |
"SnapshotId": "snap-61cb1d0a", | |
"VolumeType": "standard" | |
} | |
}, | |
"rdsmasterdb": { | |
"Type": "AWS::RDS::DBInstance", | |
"Properties": { | |
"AutoMinorVersionUpgrade": "true", | |
"DBInstanceClass": "db.t1.micro", | |
"Port": "3306", | |
"AllocatedStorage": "5", | |
"BackupRetentionPeriod": "1", | |
"DBName": "MyDatabase", | |
"Engine": "mysql", | |
"EngineVersion": "5.6.13", | |
"LicenseModel": "general-public-license", | |
"MasterUsername": "awsuser", | |
"MasterUserPassword": "MyPassword", | |
"PreferredBackupWindow": "00:00-00:30", | |
"PreferredMaintenanceWindow": "mon:01:00-mon:01:30", | |
"MultiAZ": "true", | |
"VPCSecurityGroups": [ | |
{ | |
"Ref": "sgMySQLSecurityGroup" | |
}, | |
{ | |
"Ref": "sgVPCDefaultSecurityGroup" | |
} | |
], | |
"DBSubnetGroupName": { | |
"Ref": "dbsubnetdatabasesubnet" | |
}, | |
"Tags": [ | |
{ | |
"Key": "workload-type", | |
"Value": "production" | |
} | |
] | |
} | |
}, | |
"dbsubnetdatabasesubnet": { | |
"Type": "AWS::RDS::DBSubnetGroup", | |
"Properties": { | |
"DBSubnetGroupDescription": "Subnet for VPC", | |
"SubnetIds": [ | |
{ | |
"Ref": "subneta39b99d7" | |
}, | |
{ | |
"Ref": "subnet1a67455c" | |
} | |
] | |
} | |
}, | |
"dbpgminidbparam": { | |
"Type": "AWS::RDS::DBParameterGroup", | |
"Properties": { | |
"Description": "miniDB Param Group", | |
"Family": "mysql5.6", | |
"Parameters": { | |
"binlog_cache_size": "32768", | |
"explicit_defaults_for_timestamp": "1", | |
"general_log": "1", | |
"innodb_buffer_pool_size": "{DBInstanceClassMemory*3/4}", | |
"innodb_file_per_table": "1" | |
} | |
} | |
}, | |
"sgApplicationSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Marker security group for Application server.", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"SecurityGroupEgress": [ | |
{ | |
"IpProtocol": "-1", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
} | |
}, | |
"sgNATSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Marker security group for NAT.", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"SecurityGroupEgress": [ | |
{ | |
"IpProtocol": "-1", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
} | |
}, | |
"sgMySQLSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Marker security group for MySQL server.", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"SecurityGroupEgress": [ | |
{ | |
"IpProtocol": "-1", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
} | |
}, | |
"sgVPCDefaultSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Allow all communications in VPC", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"SecurityGroupIngress": [ | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "0", | |
"ToPort": "65535", | |
"CidrIp": "10.0.0.0/16" | |
}, | |
{ | |
"IpProtocol": "udp", | |
"FromPort": "0", | |
"ToPort": "65535", | |
"CidrIp": "10.0.0.0/16" | |
}, | |
{ | |
"IpProtocol": "icmp", | |
"FromPort": "-1", | |
"ToPort": "-1", | |
"CidrIp": "10.0.0.0/16" | |
} | |
], | |
"SecurityGroupEgress": [ | |
{ | |
"IpProtocol": "-1", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
} | |
}, | |
"sgSSHSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Enable SSH access via port 22", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"SecurityGroupIngress": [ | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "22", | |
"ToPort": "22", | |
"CidrIp": "0.0.0.0/0" | |
} | |
], | |
"SecurityGroupEgress": [ | |
{ | |
"IpProtocol": "-1", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
} | |
}, | |
"sgPublicWebSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Public Security Group with HTTP access on port 443 from the internet", | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"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" | |
} | |
], | |
"SecurityGroupEgress": [ | |
{ | |
"IpProtocol": "-1", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
} | |
}, | |
"acl1": { | |
"Type": "AWS::EC2::NetworkAclEntry", | |
"Properties": { | |
"CidrBlock": "0.0.0.0/0", | |
"Egress": true, | |
"Protocol": "-1", | |
"RuleAction": "allow", | |
"RuleNumber": "100", | |
"NetworkAclId": { | |
"Ref": "acl23594041" | |
} | |
} | |
}, | |
"acl2": { | |
"Type": "AWS::EC2::NetworkAclEntry", | |
"Properties": { | |
"CidrBlock": "0.0.0.0/0", | |
"Protocol": "-1", | |
"RuleAction": "allow", | |
"RuleNumber": "100", | |
"NetworkAclId": { | |
"Ref": "acl23594041" | |
} | |
} | |
}, | |
"subnetacl1": { | |
"Type": "AWS::EC2::SubnetNetworkAclAssociation", | |
"Properties": { | |
"NetworkAclId": { | |
"Ref": "acl23594041" | |
}, | |
"SubnetId": { | |
"Ref": "subnet7a67453c" | |
} | |
} | |
}, | |
"subnetacl2": { | |
"Type": "AWS::EC2::SubnetNetworkAclAssociation", | |
"Properties": { | |
"NetworkAclId": { | |
"Ref": "acl23594041" | |
}, | |
"SubnetId": { | |
"Ref": "subneta39b99d7" | |
} | |
} | |
}, | |
"subnetacl3": { | |
"Type": "AWS::EC2::SubnetNetworkAclAssociation", | |
"Properties": { | |
"NetworkAclId": { | |
"Ref": "acl23594041" | |
}, | |
"SubnetId": { | |
"Ref": "subnet1a67455c" | |
} | |
} | |
}, | |
"subnetacl4": { | |
"Type": "AWS::EC2::SubnetNetworkAclAssociation", | |
"Properties": { | |
"NetworkAclId": { | |
"Ref": "acl23594041" | |
}, | |
"SubnetId": { | |
"Ref": "subnete0919394" | |
} | |
} | |
}, | |
"subnetacl5": { | |
"Type": "AWS::EC2::SubnetNetworkAclAssociation", | |
"Properties": { | |
"NetworkAclId": { | |
"Ref": "acl23594041" | |
}, | |
"SubnetId": { | |
"Ref": "subnete7919393" | |
} | |
} | |
}, | |
"subnetacl6": { | |
"Type": "AWS::EC2::SubnetNetworkAclAssociation", | |
"Properties": { | |
"NetworkAclId": { | |
"Ref": "acl23594041" | |
}, | |
"SubnetId": { | |
"Ref": "subnetb86644fe" | |
} | |
} | |
}, | |
"gw1": { | |
"Type": "AWS::EC2::VPCGatewayAttachment", | |
"Properties": { | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"InternetGatewayId": { | |
"Ref": "igw5c41573e" | |
} | |
} | |
}, | |
"subnetroute1": { | |
"Type": "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties": { | |
"RouteTableId": { | |
"Ref": "rtb0f6a736d" | |
}, | |
"SubnetId": { | |
"Ref": "subnetb86644fe" | |
} | |
} | |
}, | |
"subnetroute2": { | |
"Type": "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties": { | |
"RouteTableId": { | |
"Ref": "rtb0f6a736d" | |
}, | |
"SubnetId": { | |
"Ref": "subnete0919394" | |
} | |
} | |
}, | |
"subnetroute3": { | |
"Type": "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties": { | |
"RouteTableId": { | |
"Ref": "rtb0e6a736c" | |
}, | |
"SubnetId": { | |
"Ref": "subneta39b99d7" | |
} | |
} | |
}, | |
"subnetroute4": { | |
"Type": "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties": { | |
"RouteTableId": { | |
"Ref": "rtb0e6a736c" | |
}, | |
"SubnetId": { | |
"Ref": "subnete7919393" | |
} | |
} | |
}, | |
"subnetroute5": { | |
"Type": "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties": { | |
"RouteTableId": { | |
"Ref": "rtb0e6a736c" | |
}, | |
"SubnetId": { | |
"Ref": "subnet7a67453c" | |
} | |
} | |
}, | |
"subnetroute6": { | |
"Type": "AWS::EC2::SubnetRouteTableAssociation", | |
"Properties": { | |
"RouteTableId": { | |
"Ref": "rtb0e6a736c" | |
}, | |
"SubnetId": { | |
"Ref": "subnet1a67455c" | |
} | |
} | |
}, | |
"route1": { | |
"Type": "AWS::EC2::Route", | |
"Properties": { | |
"DestinationCidrBlock": "0.0.0.0/0", | |
"RouteTableId": { | |
"Ref": "rtb0f6a736d" | |
}, | |
"GatewayId": { | |
"Ref": "igw5c41573e" | |
} | |
}, | |
"DependsOn": "gw1" | |
}, | |
"route2": { | |
"Type": "AWS::EC2::Route", | |
"Properties": { | |
"DestinationCidrBlock": "0.0.0.0/0", | |
"RouteTableId": { | |
"Ref": "rtb0e6a736c" | |
}, | |
"InstanceId": { | |
"Ref": "instanceib7800bb1" | |
} | |
} | |
}, | |
"dchpassoc1": { | |
"Type": "AWS::EC2::VPCDHCPOptionsAssociation", | |
"Properties": { | |
"VpcId": { | |
"Ref": "vpc626b7500" | |
}, | |
"DhcpOptionsId": { | |
"Ref": "dopt0aebe168" | |
} | |
} | |
} | |
}, | |
"Description": "Base VPC Formation", | |
"Outputs": { | |
"subnete0919394Id": { | |
"Value": { | |
"Ref": "subnete0919394" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CloudFormerから作成したけど、これだと読みにくいし、汎用性ない。。
CloudFormerから作成するだけだとこうなるのか。同じ環境をつくってもらうにはこれでいいけどね。