57
57

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CloudFormationの作成をサポートするツール・サービス

Last updated at Posted at 2014-07-09

AWS CloudFormation ( 設定管理 & クラウドのオーケストレーション)| アマゾン ウェブ サービス(AWS 日本語)

CloudFormationはとてもよいツールですが、0ベースから記述しようと思うととても大変ですよね。
とある研修にて、AWS CloudFormationの周辺ツールを教えてもらったので紹介します。

VisualOps

VisualOps
visualops.png

VisualOpsは、GUIを用いてCloudFormationを記述することができます。
アカウントを作成し、ログインを行うと以下の様な管理画面を表示することができます。(AWSアカウントとのヒモ付を行うと、VisualOpsから直接AWS上にCloudFormationを使用して環境を構築できるようです)
visualops2.png

試しに、サンプルで用意されている「sample-apache-hadoop-v1」を選択してみます。

visualops3.png

visualops4.png

このように、Hadoopの構成が設定されています。
Exportメニューから、CloudFormationファイルを作成することができます。

visualops5.png

sample-apache-hadoop-v1.json
{
   "AWSTemplateFormatVersion":"2010-09-09",
   "Parameters":{
      "KeyPair2DefaultKP":{
         "Default":"KeyPair2DefaultKP",
         "Type":"String",
         "Description":""
      },
      "VisualOpsStackVersion":{
         "Default":"2014-02-17",
         "Type":"String",
         "Description":""
      }
   },
   "Description":"Cloudformation generated by VisualOps",
   "Resources":{
      "SecurityGroup2hmasters2Ingress23":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "FromPort":"8020",
            "ToPort":"8020",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2hmasters2Ingress22":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "FromPort":"9000",
            "ToPort":"9000",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2hmasters2Ingress21":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "FromPort":"9000",
            "ToPort":"9000",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2hmasters2Ingress20":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "FromPort":"8020",
            "ToPort":"8020",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2relay2Ingress22":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "FromPort":"0",
            "ToPort":"65535",
            "GroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "IpProtocol":"-1"
         }
      },
      "SecurityGroup2relay2Ingress20":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "ToPort":"22",
            "FromPort":"22",
            "CidrIp":"0.0.0.0/0",
            "GroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2hmasters2IpPermissions22":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "FromPort":"8020",
            "ToPort":"8020",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2DefaultSG2Ingress20":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "ToPort":"22",
            "FromPort":"22",
            "CidrIp":"0.0.0.0/0",
            "GroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2DefaultSG2Ingress21":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "FromPort":"50070",
            "ToPort":"50070",
            "GroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2datanode2Ingress21":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "FromPort":"50020",
            "ToPort":"50020",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"tcp"
         }
      },
      "VPC2vpc":{
         "Type":"AWS::EC2::VPC",
         "Properties":{
            "CidrBlock":"10.0.0.0/16",
            "EnableDnsSupport":true,
            "InstanceTenancy":"default",
            "EnableDnsHostnames":false
         }
      },
      "SecurityGroup2DefaultSG2IpPermissionsEgress20":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"65535",
            "FromPort":"0",
            "GroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "IpProtocol":"-1"
         }
      },
      "Instance2NAT":{
         "Type":"AWS::EC2::Instance",
         "Properties":{
            "Monitoring":"true",
            "ImageId":"ami-bba18dd2",
            "BlockDeviceMappings":[
               {
                  "DeviceName":"/dev/sda1",
                  "Ebs":{
                     "SnapshotId":"snap-b4ef17a9",
                     "VolumeSize":8,
                     "VolumeType":"standard"
                  }
               }
            ],
            "KeyName":{
               "Ref":"KeyPair2DefaultKP"
            },
            "InstanceType":"t1.micro",
            "NetworkInterfaces":[
               {
                  "SubnetId":{
                     "Ref":"Subnet2subnet2"
                  },
                  "DeviceIndex":"0",
                  "GroupSet":[
                     {
                        "Ref":"SecurityGroup2relay"
                     }
                  ],
                  "PrivateIpAddresses":[
                     {
                        "Primary":true,
                        "PrivateIpAddress":"10.0.2.4"
                     }
                  ],
                  "AssociatePublicIpAddress":true
               }
            ]
         }
      },
      "RouteTable2RT12RouteSet21":{
         "Type":"AWS::EC2::Route",
         "Properties":{
            "GatewayId":{
               "Ref":"InternetGateway2Internetgateway"
            },
            "DestinationCidrBlock":"0.0.0.0/0",
            "RouteTableId":{
               "Ref":"RouteTable2RT1"
            }
         }
      },
      "SecurityGroup2datanode2IpPermissions22":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "FromPort":"50020",
            "ToPort":"50020",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2datanode2IpPermissionsEgress20":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"8020",
            "FromPort":"8020",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"tcp"
         }
      },
      "NetworkInterface2NameNodeeni0":{
         "Type":"AWS::EC2::NetworkInterface",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet0"
            },
            "SourceDestCheck":true,
            "GroupSet":[
               {
                  "Ref":"SecurityGroup2DefaultSG"
               },
               {
                  "Ref":"SecurityGroup2hmasters"
               }
            ],
            "PrivateIpAddresses":[
               {
                  "Primary":true,
                  "PrivateIpAddress":"10.0.0.5"
               }
            ]
         }
      },
      "SecurityGroup2hmasters2IpPermissionsEgress20":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"65535",
            "FromPort":"0",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"-1",
            "CidrIp":"0.0.0.0/0"
         }
      },
      "NetworkInterface2DataNodeGroupAeni0":{
         "Type":"AWS::EC2::NetworkInterface",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet0"
            },
            "SourceDestCheck":true,
            "GroupSet":[
               {
                  "Ref":"SecurityGroup2DefaultSG"
               },
               {
                  "Ref":"SecurityGroup2datanode"
               }
            ],
            "PrivateIpAddresses":[
               {
                  "Primary":true,
                  "PrivateIpAddress":"10.0.0.4"
               }
            ]
         }
      },
      "SecurityGroup2DefaultSG":{
         "Type":"AWS::EC2::SecurityGroup",
         "Properties":{
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "GroupDescription":"Default Security Group"
         }
      },
      "RouteTable2RT02RouteSet21":{
         "Type":"AWS::EC2::Route",
         "Properties":{
            "DestinationCidrBlock":"0.0.0.0/0",
            "NetworkInterfaceId":{
               "Ref":"NetworkInterface2NATeni0"
            },
            "RouteTableId":{
               "Ref":"RouteTable2RT0"
            }
         }
      },
      "SecurityGroup2datanode2Egress23":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"9000",
            "FromPort":"9000",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2relay2Ingress21":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "ToPort":"80",
            "FromPort":"80",
            "CidrIp":"0.0.0.0/0",
            "GroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "IpProtocol":"tcp"
         }
      },
      "NetworkInterface2DataNodeGroupCeni0":{
         "Type":"AWS::EC2::NetworkInterface",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet3"
            },
            "SourceDestCheck":true,
            "GroupSet":[
               {
                  "Ref":"SecurityGroup2DefaultSG"
               },
               {
                  "Ref":"SecurityGroup2datanode"
               }
            ],
            "PrivateIpAddresses":[
               {
                  "Primary":true,
                  "PrivateIpAddress":"10.0.3.4"
               }
            ]
         }
      },
      "SecurityGroup2relay2Egress21":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"50070",
            "FromPort":"50070",
            "GroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2relay2Egress20":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"65535",
            "FromPort":"0",
            "GroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "IpProtocol":"-1",
            "CidrIp":"0.0.0.0/0"
         }
      },
      "SecurityGroup2DefaultSG2IpPermissions22":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "FromPort":"50070",
            "ToPort":"50070",
            "GroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "IpProtocol":"tcp"
         }
      },
      "NetworkInterface2DataNodeGroupBeni0":{
         "Type":"AWS::EC2::NetworkInterface",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet1"
            },
            "SourceDestCheck":true,
            "GroupSet":[
               {
                  "Ref":"SecurityGroup2DefaultSG"
               },
               {
                  "Ref":"SecurityGroup2datanode"
               }
            ],
            "PrivateIpAddresses":[
               {
                  "Primary":true,
                  "PrivateIpAddress":"10.0.1.4"
               }
            ]
         }
      },
      "Subnet2subnet2":{
         "Type":"AWS::EC2::Subnet",
         "Properties":{
            "Tags":[

            ],
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "CidrBlock":"10.0.2.0/24",
            "AvailabilityZone":"us-east-1a"
         }
      },
      "Subnet2subnet3":{
         "Type":"AWS::EC2::Subnet",
         "Properties":{
            "Tags":[

            ],
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "CidrBlock":"10.0.3.0/24",
            "AvailabilityZone":"us-east-1d"
         }
      },
      "Subnet2subnet0":{
         "Type":"AWS::EC2::Subnet",
         "Properties":{
            "Tags":[

            ],
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "CidrBlock":"10.0.0.0/24",
            "AvailabilityZone":"us-east-1a"
         }
      },
      "Subnet2subnet1":{
         "Type":"AWS::EC2::Subnet",
         "Properties":{
            "Tags":[

            ],
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "CidrBlock":"10.0.1.0/24",
            "AvailabilityZone":"us-east-1b"
         }
      },
      "Instance2DataNodeGroupB":{
         "Type":"AWS::EC2::Instance",
         "Properties":{
            "Monitoring":"true",
            "ImageId":"ami-bba18dd2",
            "BlockDeviceMappings":[
               {
                  "DeviceName":"/dev/sda1",
                  "Ebs":{
                     "SnapshotId":"snap-b4ef17a9",
                     "VolumeSize":8,
                     "VolumeType":"standard"
                  }
               }
            ],
            "KeyName":{
               "Ref":"KeyPair2DefaultKP"
            },
            "InstanceType":"t1.micro",
            "NetworkInterfaces":[
               {
                  "DeviceIndex":"0",
                  "NetworkInterfaceId":{
                     "Ref":"NetworkInterface2DataNodeGroupBeni0"
                  }
               }
            ]
         }
      },
      "NetworkAcl2DefaultACL2AssociationSet22":{
         "Type":"AWS::EC2::SubnetNetworkAclAssociation",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet0"
            },
            "NetworkAclId":{
               "Ref":"NetworkAcl2DefaultACL"
            }
         }
      },
      "NetworkAcl2DefaultACL2AssociationSet23":{
         "Type":"AWS::EC2::SubnetNetworkAclAssociation",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet2"
            },
            "NetworkAclId":{
               "Ref":"NetworkAcl2DefaultACL"
            }
         }
      },
      "NetworkAcl2DefaultACL2AssociationSet20":{
         "Type":"AWS::EC2::SubnetNetworkAclAssociation",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet3"
            },
            "NetworkAclId":{
               "Ref":"NetworkAcl2DefaultACL"
            }
         }
      },
      "NetworkAcl2DefaultACL2AssociationSet21":{
         "Type":"AWS::EC2::SubnetNetworkAclAssociation",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet1"
            },
            "NetworkAclId":{
               "Ref":"NetworkAcl2DefaultACL"
            }
         }
      },
      "NetworkAcl2DefaultACL":{
         "Type":"AWS::EC2::NetworkAcl",
         "Properties":{
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "Tags":[

            ]
         }
      },
      "Instance2NameNode":{
         "Type":"AWS::EC2::Instance",
         "Properties":{
            "Monitoring":"true",
            "ImageId":"ami-bba18dd2",
            "BlockDeviceMappings":[
               {
                  "DeviceName":"/dev/sda1",
                  "Ebs":{
                     "SnapshotId":"snap-b4ef17a9",
                     "VolumeSize":8,
                     "VolumeType":"standard"
                  }
               }
            ],
            "KeyName":{
               "Ref":"KeyPair2DefaultKP"
            },
            "InstanceType":"t1.micro",
            "NetworkInterfaces":[
               {
                  "DeviceIndex":"0",
                  "NetworkInterfaceId":{
                     "Ref":"NetworkInterface2NameNodeeni0"
                  }
               }
            ]
         }
      },
      "Instance2DataNodeGroupC":{
         "Type":"AWS::EC2::Instance",
         "Properties":{
            "Monitoring":"true",
            "ImageId":"ami-bba18dd2",
            "BlockDeviceMappings":[
               {
                  "DeviceName":"/dev/sda1",
                  "Ebs":{
                     "SnapshotId":"snap-b4ef17a9",
                     "VolumeSize":8,
                     "VolumeType":"standard"
                  }
               }
            ],
            "KeyName":{
               "Ref":"KeyPair2DefaultKP"
            },
            "InstanceType":"t1.micro",
            "NetworkInterfaces":[
               {
                  "DeviceIndex":"0",
                  "NetworkInterfaceId":{
                     "Ref":"NetworkInterface2DataNodeGroupCeni0"
                  }
               }
            ]
         }
      },
      "SecurityGroup2relay":{
         "Type":"AWS::EC2::SecurityGroup",
         "Properties":{
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "GroupDescription":"Custom Security Group"
         }
      },
      "NetworkInterface2SecondaryNameNodeeni0":{
         "Type":"AWS::EC2::NetworkInterface",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet1"
            },
            "SourceDestCheck":true,
            "GroupSet":[
               {
                  "Ref":"SecurityGroup2DefaultSG"
               },
               {
                  "Ref":"SecurityGroup2hmasters"
               }
            ],
            "PrivateIpAddresses":[
               {
                  "Primary":true,
                  "PrivateIpAddress":"10.0.1.5"
               }
            ]
         }
      },
      "SecurityGroup2hmasters":{
         "Type":"AWS::EC2::SecurityGroup",
         "Properties":{
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "GroupDescription":"Custom Security Group"
         }
      },
      "NetworkAcl2DefaultACL2EntrySet20":{
         "Type":"AWS::EC2::NetworkAclEntry",
         "Properties":{
            "NetworkAclId":{
               "Ref":"NetworkAcl2DefaultACL"
            },
            "RuleNumber":100,
            "Protocol":-1,
            "PortRange":{
               "To":"",
               "From":""
            },
            "Egress":true,
            "RuleAction":"allow",
            "Icmp":{
               "Code":"",
               "Type":""
            },
            "CidrBlock":"0.0.0.0/0"
         }
      },
      "Instance2SecondaryNameNode":{
         "Type":"AWS::EC2::Instance",
         "Properties":{
            "Monitoring":"true",
            "ImageId":"ami-bba18dd2",
            "BlockDeviceMappings":[
               {
                  "DeviceName":"/dev/sda1",
                  "Ebs":{
                     "SnapshotId":"snap-b4ef17a9",
                     "VolumeSize":8,
                     "VolumeType":"standard"
                  }
               }
            ],
            "KeyName":{
               "Ref":"KeyPair2DefaultKP"
            },
            "InstanceType":"t1.micro",
            "NetworkInterfaces":[
               {
                  "DeviceIndex":"0",
                  "NetworkInterfaceId":{
                     "Ref":"NetworkInterface2SecondaryNameNodeeni0"
                  }
               }
            ]
         }
      },
      "SecurityGroup2relay2IpPermissionsEgress20":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"50070",
            "FromPort":"50070",
            "GroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2hmasters2Egress20":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"8020",
            "FromPort":"8020",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2hmasters2Egress21":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"9000",
            "FromPort":"9000",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2hmasters2Egress22":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"65535",
            "FromPort":"0",
            "GroupId":{
               "Ref":"SecurityGroup2hmasters"
            },
            "IpProtocol":"-1",
            "CidrIp":"0.0.0.0/0"
         }
      },
      "RouteTable2RT12AssociationSet20":{
         "Type":"AWS::EC2::SubnetRouteTableAssociation",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet2"
            },
            "RouteTableId":{
               "Ref":"RouteTable2RT1"
            }
         }
      },
      "SecurityGroup2datanode2Egress24":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"8020",
            "FromPort":"8020",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"tcp"
         }
      },
      "Instance2DataNodeGroupA":{
         "Type":"AWS::EC2::Instance",
         "Properties":{
            "Monitoring":"true",
            "ImageId":"ami-bba18dd2",
            "BlockDeviceMappings":[
               {
                  "DeviceName":"/dev/sda1",
                  "Ebs":{
                     "SnapshotId":"snap-b4ef17a9",
                     "VolumeSize":8,
                     "VolumeType":"standard"
                  }
               }
            ],
            "KeyName":{
               "Ref":"KeyPair2DefaultKP"
            },
            "InstanceType":"t1.micro",
            "NetworkInterfaces":[
               {
                  "DeviceIndex":"0",
                  "NetworkInterfaceId":{
                     "Ref":"NetworkInterface2DataNodeGroupAeni0"
                  }
               }
            ]
         }
      },
      "SecurityGroup2datanode2Egress22":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"65535",
            "FromPort":"0",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"-1",
            "CidrIp":"0.0.0.0/0"
         }
      },
      "SecurityGroup2datanode2Egress21":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"50020",
            "FromPort":"50020",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"tcp"
         }
      },
      "SecurityGroup2datanode2Egress20":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"50010",
            "FromPort":"50010",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"tcp"
         }
      },
      "RouteTable2RT02AssociationSet23":{
         "Type":"AWS::EC2::SubnetRouteTableAssociation",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet1"
            },
            "RouteTableId":{
               "Ref":"RouteTable2RT0"
            }
         }
      },
      "RouteTable2RT02AssociationSet22":{
         "Type":"AWS::EC2::SubnetRouteTableAssociation",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet0"
            },
            "RouteTableId":{
               "Ref":"RouteTable2RT0"
            }
         }
      },
      "RouteTable2RT1":{
         "Type":"AWS::EC2::RouteTable",
         "Properties":{
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "Tags":[

            ]
         }
      },
      "SecurityGroup2DefaultSG2Egress20":{
         "Type":"AWS::EC2::SecurityGroupEgress",
         "Properties":{
            "ToPort":"65535",
            "FromPort":"0",
            "GroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "DestinationSecurityGroupId":{
               "Ref":"SecurityGroup2DefaultSG"
            },
            "IpProtocol":"-1"
         }
      },
      "RouteTable2RT02AssociationSet24":{
         "Type":"AWS::EC2::SubnetRouteTableAssociation",
         "Properties":{
            "SubnetId":{
               "Ref":"Subnet2subnet3"
            },
            "RouteTableId":{
               "Ref":"RouteTable2RT0"
            }
         }
      },
      "NetworkAcl2DefaultACL2EntrySet22":{
         "Type":"AWS::EC2::NetworkAclEntry",
         "Properties":{
            "NetworkAclId":{
               "Ref":"NetworkAcl2DefaultACL"
            },
            "RuleNumber":100,
            "Protocol":-1,
            "PortRange":{
               "To":"",
               "From":""
            },
            "RuleAction":"allow",
            "Icmp":{
               "Code":"",
               "Type":""
            },
            "CidrBlock":"0.0.0.0/0"
         }
      },
      "RouteTable2RT0":{
         "Type":"AWS::EC2::RouteTable",
         "Properties":{
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "Tags":[

            ]
         }
      },
      "SecurityGroup2datanode2Ingress20":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "FromPort":"50010",
            "ToPort":"50010",
            "GroupId":{
               "Ref":"SecurityGroup2datanode"
            },
            "IpProtocol":"tcp"
         }
      },
      "AttachInternetGateway":{
         "Type":"AWS::EC2::VPCGatewayAttachment",
         "Properties":{
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "InternetGatewayId":{
               "Ref":"InternetGateway2Internetgateway"
            }
         }
      },
      "SecurityGroup2datanode":{
         "Type":"AWS::EC2::SecurityGroup",
         "Properties":{
            "VpcId":{
               "Ref":"VPC2vpc"
            },
            "GroupDescription":"Custom Security Group"
         }
      },
      "SecurityGroup2relay2IpPermissions22":{
         "Type":"AWS::EC2::SecurityGroupIngress",
         "Properties":{
            "SourceSecurityGroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "FromPort":"0",
            "ToPort":"65535",
            "GroupId":{
               "Ref":"SecurityGroup2relay"
            },
            "IpProtocol":"-1"
         }
      },
      "InternetGateway2Internetgateway":{
         "Type":"AWS::EC2::InternetGateway",
         "Properties":{

         }
      }
   }
}

図として保存することもできるので、ネットワーク設計をVisualOpsを使って作成し、CloudFormationファイルを生成するといった使い方が良いのではないでしょうか。

CoffeeFormation

j3tm0t0/csfn
CloudFormation - CoffeeFormation - Qiita

CoffeeScriptでCloudFormationを書いてしまおうというプロジェクト。
何が一番嬉しかというと、コメントがかける!!

CloudFormationはJSON形式で記述するため、コメントが書けないんですよね。
CoffeeFormationを使用すれば、コメントを書くことができる!
メンテナンス性を考えると、CoffeeFormationを使うのが良いですね。

CloudFormation - CoffeeFormation - Qiita
こちらに作者の方が、Qiitaに書いてくださってます。

# コメント書ける!
Resources.Bucket=
  Type: "AWS::S3::Bucket"
  Properties:
    BucketName: "my-special-bucket"

こうかくと

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "Bucket": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "BucketName": "my-special-bucket"
      }
    }
  }
}

このように出力される。すばらしい。

troposphere

cloudtools/troposphere · GitHub

こちらは、Pythonを使用してCloudFormationのJSONを生成するようです。

>>> from troposphere import Ref, Template
>>> import troposphere.ec2 as ec2
>>> t = Template()
>>> instance = ec2.Instance("myinstance")
>>> instance.ImageId = "ami-951945d0"
>>> instance.InstanceType = "t1.micro"
>>> t.add_resource(instance)
<troposphere.ec2.Instance object at 0x101bf3390>
>>> print(t.to_json())
{
    "Resources": {
        "myinstance": {
            "Properties": {
                "ImageId": "ami-951945d0",
                "InstanceType": "t1.micro"
            },
            "Type": "AWS::EC2::Instance"
        }
    }
}

CloudFormation テンプレート(公式)

AWSの公式サイトに、CloudFormationの各種テンプレートが用意されています。
テンプレート - AWS CloudFormation ( 設定管理 & クラウドのオーケストレーション)| アマゾン ウェブ サービス(AWS 日本語)

57
57
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
57
57

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?