4
0

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.

AlibabaCloudのResource Orchestration Service(ROS)を触ってみる。

Last updated at Posted at 2018-05-13

今回はAlibabaCloudの
Resource Orchestration Service
に触れてみます。

Resource Orchestration Serviceとは

ROS (Resource Orchestration Service、ROS) - Alibaba Cloud プロダクト

Resource Orchestration Service (ROS) は Alibaba Cloud リソースの作成や管理を効率化するサービスです。ROS を利用することで開発者やシステム管理者の作業工数を大幅に削減することが可能です。ROS では、リソース、リソース間の依存関係、および設定の詳細をJSON形式のテキストファイルで定義できます。

AWSでいう、CloudFormationと同じものです。

コンソール画面

0.50hy26k7zjv.png

サンプルVPCを起動

0.0w1gil4o7xi.png

サンプルを起動してもどなたでも可能ですから省略します。

サンプルテンプレートのJSONを確認してみます

{
  "ROSTemplateFormatVersion" : "2015-09-01",
  "Description": "One VPC instance",
  "Parameters" : {
    "CidrBlock": {
      "Type": "String",
      "AllowedValues": ["192.168.0.0/16", "172.16.0.0/12", "10.0.0.0/8"],
      "Default": "192.168.0.0/16"
    },
    "VpcName": {
      "Type": "String",
      "Description": "The VPC name",
      "MinLength": 2,
      "MaxLength": 128,
      "ConstraintDescription": "[2, 128] English or Chinese letters"
    }
  },
  "Resources" : {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": {"Ref": "CidrBlock"},
        "VpcName": {"Ref": "VpcName"}
      }
    }
  },
  "Outputs": {
    "VpcId": {
      "Value" : {"Fn::GetAtt": ["Vpc", "VpcId"]}
    },
    "VRouterId": {
      "Value" : {"Fn::GetAtt": ["Vpc", "VRouterId"]}
    },
    "RouteTableId": {
      "Value" : {"Fn::GetAtt": ["Vpc", "RouteTableId"]}
    }
  }
}

サンプルテンプレートを参考にVPCのVSwitchを増やします。

サブネットは下記の表のようにしました。
仮想サーバ、ロードバランサー、データベースで分けました。

VSwitch サブネット
ECS 10.0.0.0/24
SLB 10.0.1.0/24
RDS 10.0.2.0/24

ALIYUN::ECS::VSwitch
をみて、下記のように変更しました。

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "poc",
  "Parameters": {
    "CidrBlock": {
      "AllowedValues": [
        "192.168.0.0/16",
        "172.16.0.0/12",
        "10.0.0.0/8"
      ],
      "Default": "10.0.0.0/8",
      "Type": "String"
    },
    "VpcName": {
      "ConstraintDescription": "[2, 128] English or Chinese letters",
      "Default": "poc",
      "Description": "The VPC name",
      "MaxLength": 128,
      "MinLength": 2,
      "Type": "String"
    }
  },
  "Conditions": {},
  "Mappings": {},
  "Resources": {
    "VSwitch-ECS": {
      "Metadata": {
        "GraphicId": "RosGraphicElement-2"
      },
      "Properties": {
        "CidrBlock": "10.0.0.0/24",
        "Description": "ecs",
        "VSwitchName": "ecs",
        "VpcId": {
          "Ref": "Vpc"
        },
        "ZoneId": "ap-northeast-1a"
      },
      "Type": "ALIYUN::ECS::VSwitch"
    },
    "VSwitch-RDS": {
      "Metadata": {
        "GraphicId": "RosGraphicElement-4"
      },
      "Properties": {
        "CidrBlock": "10.0.2.0/24",
        "Description": "rds",
        "VSwitchName": "rds",
        "VpcId": {
          "Ref": "Vpc"
        },
        "ZoneId": "ap-northeast-1a"
      },
      "Type": "ALIYUN::ECS::VSwitch"
    },
    "VSwitch-SLB": {
      "Metadata": {
        "GraphicId": "RosGraphicElement-3"
      },
      "Properties": {
        "CidrBlock": "10.0.1.0/24",
        "Description": "slb",
        "VSwitchName": "slb",
        "VpcId": {
          "Ref": "Vpc"
        },
        "ZoneId": "ap-northeast-1a"
      },
      "Type": "ALIYUN::ECS::VSwitch"
    },
    "Vpc": {
      "Metadata": {
        "GraphicId": "RosGraphicElement-1"
      },
      "Properties": {
        "CidrBlock": "10.0.0.0/8",
        "VpcName": {
          "Ref": "VpcName"
        }
      },
      "Type": "ALIYUN::ECS::VPC"
    }
  },
  "Outputs": {
    "RouteTableId": {
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "RouteTableId"
        ]
      }
    },
    "VRouterId": {
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "VRouterId"
        ]
      }
    },
    "VSwitch-ECS": {
      "Value": {
        "Fn::GetAtt": [
          "VSwitch-ECS",
          "VSwitchId"
        ]
      }
    },
    "VSwitch-RDS": {
      "Value": {
        "Fn::GetAtt": [
          "VSwitch-RDS",
          "VSwitchId"
        ]
      }
    },
    "VSwitch-SLB": {
      "Value": {
        "Fn::GetAtt": [
          "VSwitch-ECS",
          "VSwitchId"
        ]
      }
    },
    "VpcId": {
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "VpcId"
        ]
      }
    }
  }
}

ROSのスタックを作るとできあがりです。

0.96uoq0e04qk.png

4
0
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
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?