Resource Orchestration Service (ROS) integration example

更新时间:
复制 MD 格式

This topic describes how a RAM user can use Resource Orchestration Service to query information about an ApsaraDB for ClickHouse cluster.

Prerequisites

You need a RAM user to use Resource Orchestration Service. Create a RAM user and grant it the following permissions.

  • Full access to Resource Orchestration Service: AliyunROSFullAccess.

  • Full access to ApsaraDB for ClickHouse: AliyunClickHouseFullAccess.

    Note

    For demonstration purposes, this example uses the AliyunClickHouseFullAccess policy. In a production environment, grant permissions based on your business requirements and the principle of least privilege. For more information about ApsaraDB for ClickHouse permission policies, see Identity-based policies.

Procedure

  1. Log on to the ROS console. In the top navigation bar, select your desired region from the region drop-down list.

  2. In the left-side navigation pane, click Stack, and then choose Create Stack > Use ROS.

    • Specify Template: Select Select an Existing Template.

    • Template Import Method: Select Enter Template Content.

  3. In the Template content section, select ROS and enter the template code.

    The following code is a template for a ROS data source that queries information about ApsaraDB for ClickHouse clusters. For more details, see DATASOURCE::ClickHouse::DBClusters.

    YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      DBClusterId:
        Description: The cluster ID.
        Type: String
      DBClusterName:
        Description: The cluster description.
        Type: String
    Resources:
      ExtensionDataSource:
        Properties:
          DBClusterId:
            Ref: DBClusterId
          DBClusterName:
            Ref: DBClusterName
        Type: DATASOURCE::ClickHouse::DBClusters
    Outputs:
      DBClusterIds:
        Description: The list of cluster IDs.
        Value:
          Fn::GetAtt:
          - ExtensionDataSource
          - DBClusterIds
      DBClusters:
        Description: The list of clusters.
        Value:
          Fn::GetAtt:
          - ExtensionDataSource
          - DBClusters

    JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "DBClusterName": {
          "Type": "String",
          "Description": "The cluster description."
        },
        "DBClusterId": {
          "Type": "String",
          "Description": "The cluster ID."
        }
      },
      "Resources": {
        "ExtensionDataSource": {
          "Type": "DATASOURCE::ClickHouse::DBClusters",
          "Properties": {
            "DBClusterName": {
              "Ref": "DBClusterName"
            },
            "DBClusterId": {
              "Ref": "DBClusterId"
            }
          }
        }
      },
      "Outputs": {
        "DBClusterIds": {
          "Description": "The list of cluster IDs.",
          "Value": {
            "Fn::GetAtt": [
              "ExtensionDataSource",
              "DBClusterIds"
            ]
          }
        },
        "DBClusters": {
          "Description": "The list of clusters.",
          "Value": {
            "Fn::GetAtt": [
              "ExtensionDataSource",
              "DBClusters"
            ]
          }
        }
      }
    }
  4. Click Next.

  5. On the Create Stack page, configure the following parameters.

    For demonstration purposes, only the required parameters for this example are listed. For more information about the parameters for creating a stack, see Create a stack by using an existing template.

    Parameter

    Required

    Description

    Example

    Stack Name

    Yes

    The name of the stack.

    getClickHouseInfoTest

    DBClusterId

    Yes

    The cluster ID.

    cc-bp1gf42v00340****

    DBClusterName

    Yes

    The cluster name.

    testROS

  6. Click create one..

    After the stack is created, its Status on the Stack Information tab changes to Create successful.

  7. After the stack is created successfully, click the Outputs tab to view the cluster details.