全部产品
Search
文档中心

资源编排:ALIYUN::ADB::DBCluster

更新时间:Jun 13, 2024

ALIYUN::ADB::DBCluster类型用于创建一个AnalyticDB MySQL版集群。

语法

{
  "Type": "ALIYUN::ADB::DBCluster",
  "Properties": {
    "DBNodeStorage": Integer,
    "PeriodType": String,
    "DBClusterCategory": String,
    "ZoneId": String,
    "ResourceGroupId": String,
    "VPCId": String,
    "VSwitchId": String,
    "Mode": String,
    "DBClusterDescription": String,
    "ComputeResource": String,
    "Period": Integer,
    "PayType": String,
    "ElasticIOResource": Integer,
    "DBClusterVersion": String,
    "DBNodeGroupCount": Integer,
    "ExecutorCount": Integer,
    "DBClusterClass": String,
    "Tags": List
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

DBClusterCategory

String

系列。

取值:

  • Cluster:预留模式集群版。

    说明

    仅中国内地地域和新加坡地域支持购买预留模式集群版。其中,新加坡地域仅支持在按量付费模式下购买预留模式集群版。

  • MixedStorage:弹性模式集群版(新版)。

    说明

    当DBClusterCategory为Cluster时,Mode参数必须填写Reserver;当DBClusterCategory为MixedStorage时,Mode参数必须填写Flexible,否则会导致创建集群失败。

更多信息,请参见产品系列

DBClusterVersion

String

AnalyticDB MySQL集群版本。

取值:3.0。

Mode

String

模式。

取值:

  • Reserver:预留模式。

  • Flexible:弹性模式。

    说明

    本参数不填写时,默认为预留模式。

PayType

String

付费类型。

取值:

  • Postpaid:按量付费。

  • Prepaid:预付费(包年包月)。

VPCId

String

专有网络ID。

VSwitchId

String

交换机ID。

ComputeResource

String

计算资源。

计算资源。

Mode取值为Flexible(即弹性模式)时,本参数必填。

说明

您可以调用DescribeAvailableResource 接口查询指定地域中可用的计算资源。

DBClusterClass

String

规格。

集群规格。取值:

  • C8

  • C32

说明

Mode取值为Reserver(即预留模式)时,本参数必填。

DBClusterDescription

String

备注信息。

DBNodeGroupCount

Integer

节点组数量。

取值范围为:1~200(整数)。

说明

Mode取值为Reserver(即预留模式)时,本参数必填。

DBNodeStorage

Integer

节点存储空间。

仅当Mode取值为Reserver时,该属性必选。

单位:GB。

取值:

  • 规格为C8时,取值范围为:100~1000。

  • 规格为C32时,取值范围为:100~8000。

说明

1000 GB以下步长为100 GB,1000 GB以上步长为1000 GB。

ElasticIOResource

Integer

弹性IO资源(Elastic IO Unit,简称EIU)。

仅当Mode取值为Flexible时,该属性必选。

更多信息,请参见弹性IO资源(EIU)扩容

ExecutorCount

Integer

弹性模式下集群使用的计算节点数量。

Period

Integer

包年包月时长。

仅当PayType取值为Prepaid时,该属性必选。

取值:

  • 包月时:1~9。

  • 包年时:1~3。

PeriodType

String

指定预付费集群为包年或包月类型。

仅当PayType取值为Prepaid时,该属性必选。

取值:

  • Year:包年。

  • Month:包月。

ResourceGroupId

String

资源组ID。

Tags

List

标签。

最多添加20个标签。

更多信息,请参见Tags属性

ZoneId

String

可用区ID。

通过调用DescribeRegions查询可用区列表。

Tags语法

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

长度为1~128个字符,不能以aliyunacs:开头,不能包含http://https://

Value

String

标签值。

长度为0~128个字符,不能以aliyunacs:开头,不能包含http://https://

返回值

Fn::GetAtt

  • DBClusterId:集群ID。

  • OrderId:订单ID。

  • ConnectionString:VPC连接字符串。

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBClusterCategory:
    Type: String
    Description: |-
      The edition of the cluster.
      Valid values when the cluster is in reserved mode:
      Basic
      Cluster
      When the cluster is in elastic mode, set the value to MixedStorage.
    AllowedValues:
      - Basic
      - Cluster
      - MixedStorage
    Default: MixedStorage
  ZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description: The zone ID of the cluster. You can call the DescribeRegions operation to query the most recent zone list.
  VPCId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description: |-
      The ID of the VPC.
      Note If you leave this parameter empty, the default VPC or vSwitch of the specified region is used. If the region does not have a default VPC, a VPC is created.
  VSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    Type: String
    Description: The ID of the vSwitch.
    AssociationPropertyMetadata:
      VpcId: VPC
      ZoneId: VSwitchZoneId
  Mode:
    Type: String
    Description: |-
      The mode of the cluster. Valid values:
      Reserver: the reserved mode
      Flexible: the elastic mode
    AllowedValues:
      - Reserver
      - Flexible
    Default: Flexible
  ComputeResource:
    Type: String
    Description: The computing resource of the cluster. This parameter is required in elastic mode.
    Default: 8Core32GB
  PayType:
    Type: String
    Description: |-
      The billing method of the cluster. Valid values:
      Postpaid: pay-as-you-go
      Prepaid: subscription
    AllowedValues:
      - Prepaid
      - PostPaid
    Default: PostPaid
  ElasticIOResource:
    Type: Number
    Description: |-
      Elastic IO Unit
      Note the flexible mode cluster will use this parameter.
    Default: 0
  DBClusterVersion:
    Type: String
    Description: The version of the cluster. Set the value to 3.0.
    Default: '3.0'
Resources:
  DBCluster:
    Type: ALIYUN::ADB::DBCluster
    Properties:
      DBClusterCategory:
        Ref: DBClusterCategory
      ZoneId:
        Ref: ZoneId
      VPCId:
        Ref: VPCId
      VSwitchId:
        Ref: VSwitchId
      Mode:
        Ref: Mode
      ComputeResource:
        Ref: ComputeResource
      PayType:
        Ref: PayType
      ElasticIOResource:
        Ref: ElasticIOResource
      DBClusterVersion:
        Ref: DBClusterVersion
Outputs:
  DBClusterId:
    Description: The ID of the cluster.
    Value:
      Fn::GetAtt:
        - DBCluster
        - DBClusterId
  OrderId:
    Description: The ID of the order.
    Value:
      Fn::GetAtt:
        - DBCluster
        - OrderId
  ConnectionString:
    Description: Vpc connection string.
    Value:
      Fn::GetAtt:
        - DBCluster
        - ConnectionString

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DBClusterCategory": {
      "Type": "String",
      "Description": "The edition of the cluster.\nValid values when the cluster is in reserved mode:\nBasic\nCluster\nWhen the cluster is in elastic mode, set the value to MixedStorage.",
      "AllowedValues": [
        "Basic",
        "Cluster",
        "MixedStorage"
      ],
      "Default": "MixedStorage"
    },
    "ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": "The zone ID of the cluster. You can call the DescribeRegions operation to query the most recent zone list."
    },
    "VPCId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": "The ID of the VPC.\nNote If you leave this parameter empty, the default VPC or vSwitch of the specified region is used. If the region does not have a default VPC, a VPC is created."
    },
    "VSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "Type": "String",
      "Description": "The ID of the vSwitch.",
      "AssociationPropertyMetadata": {
        "VpcId": "VPC",
        "ZoneId": "VSwitchZoneId"
      }
    },
    "Mode": {
      "Type": "String",
      "Description": "The mode of the cluster. Valid values:\nReserver: the reserved mode\nFlexible: the elastic mode",
      "AllowedValues": [
        "Reserver",
        "Flexible"
      ],
      "Default": "Flexible"
    },
    "ComputeResource": {
      "Type": "String",
      "Description": "The computing resource of the cluster. This parameter is required in elastic mode.",
      "Default": "8Core32GB"
    },
    "PayType": {
      "Type": "String",
      "Description": "The billing method of the cluster. Valid values:\nPostpaid: pay-as-you-go\nPrepaid: subscription",
      "AllowedValues": [
        "Prepaid",
        "PostPaid"
      ],
      "Default": "PostPaid"
    },
    "ElasticIOResource": {
      "Type": "Number",
      "Description": "Elastic IO Unit\nNote the flexible mode cluster will use this parameter.",
      "Default": 0
    },
    "DBClusterVersion": {
      "Type": "String",
      "Description": "The version of the cluster. Set the value to 3.0.",
      "Default": "3.0"
    }
  },
  "Resources": {
    "DBCluster": {
      "Type": "ALIYUN::ADB::DBCluster",
      "Properties": {
        "DBClusterCategory": {
          "Ref": "DBClusterCategory"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VPCId": {
          "Ref": "VPCId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "Mode": {
          "Ref": "Mode"
        },
        "ComputeResource": {
          "Ref": "ComputeResource"
        },
        "PayType": {
          "Ref": "PayType"
        },
        "ElasticIOResource": {
          "Ref": "ElasticIOResource"
        },
        "DBClusterVersion": {
          "Ref": "DBClusterVersion"
        }
      }
    }
  },
  "Outputs": {
    "DBClusterId": {
      "Description": "The ID of the cluster.",
      "Value": {
        "Fn::GetAtt": [
          "DBCluster",
          "DBClusterId"
        ]
      }
    },
    "OrderId": {
      "Description": "The ID of the order.",
      "Value": {
        "Fn::GetAtt": [
          "DBCluster",
          "OrderId"
        ]
      }
    },
    "ConnectionString": {
      "Description": "Vpc connection string.",
      "Value": {
        "Fn::GetAtt": [
          "DBCluster",
          "ConnectionString"
        ]
      }
    }
  }
}