ようやくという感じですが、EC2インスタンス生成を追加します。
Cloudformationファイルで記述すると
インスタンス数は4つしかないですが、ストレージデバイスのタグを記載すると長くなっちゃいますね。
"WEBSRV1a" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "WEBInstanceType" }, "Arch" ] } ] },
"NetworkInterfaces" : [{
"PrivateIpAddress" : { "Fn::FindInMap" : [ "IPAddress", "WEB1a", { "Ref" : "NetworkStructure" } ]},
"GroupSet" : [{ "Ref" : "SGWEBSRV" }, { "Ref" : "SGVPNSRV"}],
"AssociatePublicIpAddress" : "false",
"DeviceIndex" : "0",
"DeleteOnTermination" : "true",
"SubnetId" : { "Ref" : "WEB1a" }
}],
"BlockDeviceMappings" : [
{
"DeviceName" : "/dev/sda1",
"Ebs" : {
"VolumeType" : { "Fn::FindInMap" : [ "OSVolumeType", "WEB", { "Ref" : "NetworkStructure" } ]},
"VolumeSize" : { "Fn::FindInMap" : [ "OSVolumeSize", "WEB", { "Ref" : "NetworkStructure" } ]},
"DeleteOnTermination" : "true"
},
"Tag" : {
"Key" : "Name", "Value" : "WEB1a-OS"
}
},
{
"DeviceName" : "/dev/sdf",
"Ebs" : {
"VolumeType" : { "Fn::FindInMap" : [ "DATAVolumeType", "WEB", { "Ref" : "NetworkStructure" } ]},
"VolumeSize" : { "Fn::FindInMap" : [ "DATAVolumeSize", "WEB", { "Ref" : "NetworkStructure" } ]},
"DeleteOnTermination" : "true"
},
"Tag" : {
"Key" : "Name", "Value" : "WEB1a-DATA"
}
}
],
"Tag" : {
"Key" : "Name", "Value" : "WEB1a"
},
"UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }}
}
},
"WEBSRV1c" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"SecurityGroups" : [ { "Ref" : "SGWEBSRV" } ],
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "WEBInstanceType" }, "Arch" ] } ] },
"NetworkInterfaces" : [{
"GroupSet" : [{ "Ref" : "SGWEBSRV" }, { "Ref" : "SGVPNSRV"}],
"AssociatePublicIpAddress" : "false",
"DeviceIndex" : "0",
"DeleteOnTermination" : "true",
"SubnetId" : { "Ref" : "WEB1c" }
}],
"BlockDeviceMappings" : [
{
"DeviceName" : "/dev/sda1",
"Ebs" : {
"VolumeType" : { "Fn::FindInMap" : [ "OSVolumeType", "WEB", { "Ref" : "NetworkStructure" } ]},
"VolumeSize" : { "Fn::FindInMap" : [ "OSVolumeSize", "WEB", { "Ref" : "NetworkStructure" } ]},
"DeleteOnTermination" : "true"
},
"Tag" : {
"Key" : "Name", "Value" : "WEB1a-OS"
}
},
{
"DeviceName" : "/dev/sdf",
"Ebs" : {
"VolumeType" : { "Fn::FindInMap" : [ "DATAVolumeType", "WEB", { "Ref" : "NetworkStructure" } ]},
"VolumeSize" : { "Fn::FindInMap" : [ "DATAVolumeSize", "WEB", { "Ref" : "NetworkStructure" } ]},
"DeleteOnTermination" : "true"
},
"Tag" : {
"Key" : "Name", "Value" : "WEB1a-DATA"
}
}
],
"Tag" : {
"Key" : "Name", "Value" : "WEB1a"
},
"UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }}
}
"PRIVSRV11a" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"SecurityGroups" : [ { "Ref" : "SG-RDBSRV" } ],
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "EC2InstanceType" }, "Arch" ] } ] },
"NetworkInterfaces" : [{
"GroupSet" : [{ "Ref" : "SGPRIVSRV" }, { "Ref" : "SGVPNSRV"}],
"AssociatePublicIpAddress" : "false",
"DeviceIndex" : "0",
"DeleteOnTermination" : "true",
"SubnetId" : { "Ref" : "PRIV11a" }
}],
"BlockDeviceMappings" : [
{
"DeviceName" : "/dev/sda1",
"Ebs" : {
"VolumeType" : { "Fn::FindInMap" : [ "OSVolumeType", "WEB", { "Ref" : "NetworkStructure" } ]},
"VolumeSize" : { "Fn::FindInMap" : [ "OSVolumeSize", "WEB", { "Ref" : "NetworkStructure" } ]},
"DeleteOnTermination" : "true"
},
"Tag" : {
"Key" : "Name", "Value" : "WEB1a-OS"
}
},
{
"DeviceName" : "/dev/sdf",
"Ebs" : {
"VolumeType" : { "Fn::FindInMap" : [ "DATAVolumeType", "WEB", { "Ref" : "NetworkStructure" } ]},
"VolumeSize" : { "Fn::FindInMap" : [ "DATAVolumeSize", "WEB", { "Ref" : "NetworkStructure" } ]},
"DeleteOnTermination" : "true"
},
"Tag" : {
"Key" : "Name", "Value" : "WEB1a-DATA"
}
}
],
"Tag" : {
"Key" : "Name", "Value" : "WEB1a"
},
"UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }}
}
},
"PRIVSRV11c" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"SecurityGroups" : [ { "Ref" : "SG-RDBSRV" } ],
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "DBInstanceType" }, "Arch" ] } ] },
"NetworkInterfaces" : [{
"GroupSet" : [{ "Ref" : "SGPRIVSRV" }, { "Ref" : "SGVPNSRV"}],
"AssociatePublicIpAddress" : "false",
"DeviceIndex" : "0",
"DeleteOnTermination" : "true",
"SubnetId" : { "Ref" : "PRIV11c" }
}],
"BlockDeviceMappings" : [
{
"DeviceName" : "/dev/sda1",
"Ebs" : {
"VolumeType" : { "Fn::FindInMap" : [ "OSVolumeType", "WEB", { "Ref" : "NetworkStructure" } ]},
"VolumeSize" : { "Fn::FindInMap" : [ "OSVolumeSize", "WEB", { "Ref" : "NetworkStructure" } ]},
"DeleteOnTermination" : "true"
},
"Tag" : {
"Key" : "Name", "Value" : "WEB1a-OS"
}
},
{
"DeviceName" : "/dev/sdf",
"Ebs" : {
"VolumeType" : { "Fn::FindInMap" : [ "DATAVolumeType", "WEB", { "Ref" : "NetworkStructure" } ]},
"VolumeSize" : { "Fn::FindInMap" : [ "DATAVolumeSize", "WEB", { "Ref" : "NetworkStructure" } ]},
"DeleteOnTermination" : "true"
},
"Tag" : {
"Key" : "Name", "Value" : "WEB1a-DATA"
}
}
],
"Tag" : {
"Key" : "Name", "Value" : "WEB1a"
},
"UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }}
}