CloudFormationを使用してネットワーク部分の構築[cloudpack大阪ブログ]

自動デプロイのサービスとして以前Elastic Beanstalkを使用しましたが
今回CloudFormationを使用してネットワーク部分の構築をしましたので備忘録。
CloudFormationテンプレートの構造
テンプレートはJSONで記述
ネットワーク部分の構築
JSON記述について下記フォーマットを参考
<VPC>
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "<IPアドレス>/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
"Tags": [
{
"Key": "Name",
"Value": "<VPC名>"
}
]
}
},
<サブネット>
"SubnetTrustAZa": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "<IPアドレス>/24",
"AvailabilityZone": "ap-northeast-1a",
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": "<サブネット名>"
}
]
}
},
<InternetGateway>
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "<InternetGateway名>"
}
]
}
},
<DHCPオプションセット>
"DHCPOptions": {
"Type": "AWS::EC2::DHCPOptions",
"Properties": {
"DomainName": "ap-northeast-1.compute.internal",
"DomainNameServers": [
"AmazonProvidedDNS"
]
}
},
<NetworkAcl>
"NetworkAcl": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"VpcId": {
"Ref": "VPC"
}
}
},
<RouteTable>
"RouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "VPC"
}
}
},


