资源编排ROS集成示例

本文以创建实例为例介绍如何通过资源编排ROS使用表格存储

前提条件

开通表格存储服务

操作步骤

  1. 进入资源栈页面。

    1. 登录资源编排控制台

    2. 在左侧导航栏,选择部署 > 资源栈

    3. 在顶部菜单栏,选择地域。

  2. 创建资源栈。

    1. 在资源栈列表页面,单击创建资源栈

    2. 指定模板区域,单击选择已有模板,并选择模板录入方式输入模板

    3. 模板内容区域的ROS页签输入YAMLJSON格式的模板,然后单击下一步

      V2(推荐)

      以下是V2版创建表格存储实例的示例模板。更多语法、参数和示例信息,请参见ALIYUN::OTS::InstanceV2

      JSON格式

      {
        "ROSTemplateFormatVersion": "2015-09-01",
        "Parameters": {
          "InstanceName": {
            "Type": "String",
            "Description": {
              "en": "Instance name.The naming specifications for instances are as follows:\nMust consist of English letters, numbers or dash lines (-).\nThe first character must be in English letters.\nThe end character cannot be a dash (-).\nInsensitive case.\nThe length is between 3 and 16 characters.\n"
            },
            "Required": true,
            "AllowedPattern": "[A-Za-z][A-Za-z0-9\\-]*[A-Za-z0-9]$",
            "MinLength": 3,
            "MaxLength": 16
          },
          "ClusterType": {
            "Type": "String",
            "Description": {
              "en": "Cluster type (i.e. instance specification).\nEnumeration values:\nSSD: High performance.\nHYBRID: Capacity type."
            },
            "AllowedValues": [
              "SSD",
              "HYBRID"
            ],
            "Required": true
          }
        },
        "Resources": {
          "InstanceV2": {
            "Type": "ALIYUN::OTS::InstanceV2",
            "Properties": {
              "InstanceName": {
                "Ref": "InstanceName"
              },
              "InstanceDescription": "The description of the instance.",
              "ClusterType": {
                "Ref": "ClusterType"
              },
              "NetworkSourceACL": [
                "TRUST_PROXY"
              ],
              "NetworkTypeACL": [
                "INTERNET",
                "VPC",
                "CLASSIC"
              ],
              "Tags": [
                {
                  "Key": "environment",
                  "Value": "testing"
                }
              ]
            }
          }
        },
        "Outputs": {
          "InstanceName": {
            "Description": "Name of the tablestore instance.",
            "Value": {
              "Fn::GetAtt": [
                "InstanceV2",
                "InstanceName"
              ]
            }
          }
        }
      }

      YAML格式

      ROSTemplateFormatVersion: '2015-09-01'
      Parameters:
        InstanceName:
          Type: String
          Description:
            en: |
              Instance name.The naming specifications for instances are as follows:
              Must consist of English letters, numbers or dash lines (-).
              The first character must be in English letters.
              The end character cannot be a dash (-).
              Insensitive case.
              The length is between 3 and 16 characters.
          Required: true
          AllowedPattern: '[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9]$'
          MinLength: 3
          MaxLength: 16
        ClusterType:
          Type: String
          Description:
            en: |-
              Cluster type (i.e. instance specification).
              Enumeration values:
              SSD: High performance.
              HYBRID: Capacity type.
          AllowedValues:
            - SSD
            - HYBRID
          Required: true
      Resources:
        InstanceV2:
          Type: ALIYUN::OTS::InstanceV2
          Properties:
            InstanceName:
              Ref: InstanceName
            InstanceDescription: The description of the instance.
            ClusterType:
              Ref: ClusterType
            NetworkSourceACL: 
              - TRUST_PROXY
            NetworkTypeACL:
              - INTERNET
              - VPC
              - CLASSIC
            Tags:
              - Key: "environment"
                Value: "testing"
      Outputs:
        InstanceName:
          Description: Name of the tablestore instance.
          Value:
            Fn::GetAtt:
              - InstanceV2
              - InstanceName

      V1

      以下是V1版创建表格存储实例的示例模板。更多语法、参数和示例信息,请参见ALIYUN::OTS::Instance

      JSON格式

      {
        "ROSTemplateFormatVersion": "2015-09-01",
        "Parameters": {
        },
        "Resources": {
          "Instance": {
            "Type": "ALIYUN::OTS::Instance",
            "Properties": {
              "InstanceName": "instance-demo",
              "Description": "The description of the instance.",
              "ClusterType": "SSD",
              "Network": "NORMAL"
            }
          }
        },
        "Outputs": {
          "InstanceName": {
            "Description": "Instance name",
            "Value": {
              "Fn::GetAtt": [
                "Instance",
                "InstanceName"
              ]
            }
          },
          "VpcEndpoint": {
            "Description": "Vpc endpoint",
            "Value": {
              "Fn::GetAtt": [
                "Instance",
                "VpcEndpoint"
              ]
            }
          },
          "PublicEndpoint": {
            "Description": "Public endpoint",
            "Value": {
              "Fn::GetAtt": [
                "Instance",
                "PublicEndpoint"
              ]
            }
          },
          "PrivateEndpoint": {
            "Description": "Private endpoint",
            "Value": {
              "Fn::GetAtt": [
                "Instance",
                "PrivateEndpoint"
              ]
            }
          }
        }
      }

      YAML格式

      ROSTemplateFormatVersion: '2015-09-01'
      Parameters: {}
      Resources:
        Instance:
          Type: ALIYUN::OTS::Instance
          Properties:
            InstanceName: instance-demo
            Description: The description of the instance.
            ClusterType: SSD
            Network: NORMAL
      Outputs:
        InstanceName:
          Description: Instance name
          Value:
            Fn::GetAtt:
              - Instance
              - InstanceName
        VpcEndpoint:
          Description: Vpc endpoint
          Value:
            Fn::GetAtt:
              - Instance
              - VpcEndpoint
        PublicEndpoint:
          Description: Public endpoint
          Value:
            Fn::GetAtt:
              - Instance
              - PublicEndpoint
        PrivateEndpoint:
          Description: Private endpoint
          Value:
            Fn::GetAtt:
              - Instance
              - PrivateEndpoint
    4. 配置参数步骤,填写资源栈名称,V2版本还需填写实例名称(InstanceName)并选择实例规格(ClusterType)。更多资源栈配置请参见资源栈配置项说明

    5. 单击创建

      创建成功后,在资源栈信息页签的状态列将显示创建成功

      image

  3. 查看资源栈。

    单击资源页签,查看资源ID(即表格存储的实例名称)。

    image

    您可以登录表格存储控制台,查看创建的实例。

    image

相关文档