ALIYUN::POLARDB::DBCluster类型用于创建PolarDB集群。
语法
{
  "Type": "ALIYUN::POLARDB::DBCluster",
  "Properties": {
    "VpcId": String,
    "DBClusterDescription": String,
    "DBType": String,
    "ClusterNetworkType": String,
    "RenewalStatus": String,
    "AutoRenewPeriod": Integer,
    "Period": Integer,
    "ZoneId": String,
    "SecurityGroupIds": List,
    "Tags": List,
    "SourceResourceId": String,
    "MaintainTime": String,
    "DBVersion": String,
    "CreationOption": String,
    "DBNodeClass": String,
    "VSwitchId": String,
    "SecurityIPList": String,
    "CloneDataPoint": String,
    "PayType": String,
    "CreationCategory": String,
    "BackupRetentionPolicyOnClusterDeletion": String,
    "ResourceGroupId": String,
    "DefaultTimeZone": String,
    "GDNId": String,
    "LowerCaseTableNames": Integer,
    "DBClusterParameters": Map,
    "TDEStatus": Boolean,
    "PeriodUnit": String,
    "ScaleRoNumMin": Integer,
    "ScaleMax": Integer,
    "AllowShutDown": Boolean,
    "ServerlessType": String,
    "ScaleRoNumMax": Integer,
    "ScaleMin": Integer,
    "StorageType": String,
    "LooseXEngine": String,
    "LoosePolarLogBin": String,
    "StorageSpace": Integer,
    "ProxyType": String,
    "StandbyAZ": String,
    "LooseXEngineUseMemoryPct": Integer,
    "StorageUpperBound": Integer,
    "StrictConsistency": String,
    "StoragePayType": String,
    "DBNodeNum": Integer,
    "ProxyClass": String,
    "HotStandbyCluster": String,
    "StorageAutoScale": String,
    "Architecture": String,
    "DBMinorVersion": String,
    "ParameterGroupId": String,
    "RestartMasterNode": Boolean,
    "ColdStorageOption": Map,
    "ProvisionedIops": Integer,
    "DeletionProtection": Boolean,
    "SSLEnabled": String
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| DBType | String | 是 | 否 | 数据库引擎类型。 | 取值: 
 | 
| DBNodeClass | String | 是 | 否 | 节点规格。 | 节点规格,详情请参见如下文档: 说明  PolarDB MySQL 集群版中如需创建 Serverless 集群,请传入polar.mysql.sl.small。 PolarDB MySQL 标准版如需创建 Serverless 集群,请传入polar.mysql.sl.small.c。 PolarDB PostgreSQL 版(兼容 Oracle)和 PolarDB PostgreSQL 版中如需创建 Serverless 集群,请传入polar.pg.sl.small.c。 | 
| DBVersion | String | 是 | 否 | 数据库版本号。 | 取值: 
 | 
| PayType | String | 是 | 是 | 付费类型。 | 取值: 
 | 
| AutoRenewPeriod | Integer | 否 | 是 | 实例自动续费时长。 | 取值: 
 单位:月。 | 
| DBClusterDescription | String | 否 | 是 | 集群描述。 | 长度为2~256个字符。以英文字母或汉字开头,不能以 | 
| ClusterNetworkType | String | 否 | 否 | 集群网络类型。 | 当前仅支持专有网络,取值:VPC。 | 
| RenewalStatus | String | 否 | 是 | 自动续费状态。 | 取值: 
 | 
| Period | Integer | 否 | 是 | 预付费类型(即PayType为Prepaid时)实例的时长。 | 取值: 
 单位:月。 | 
| ZoneId | String | 否 | 否 | 可用区ID。 | 您可以通过DescribeRegions接口查询可选的可用区。 | 
| SourceResourceId | String | 否 | 否 | 源RDS实例ID或源PolarDB集群ID。 | 源 RDS 实例 ID 或源 PolarDB 集群 ID。仅当 CreationOption 为 MigrationFromRDS、CloneFromRDS、CloneFromPolarDB 或 RecoverFromRecyclebin 时,该参数必填。 
 | 
| SecurityGroupIds | List | 否 | 是 | 安全组ID列表。 | 最多支持3个安全组。 | 
| Tags | List | 否 | 是 | 标签。 | 最多支持添加20个标签。 更多信息,请参见Tags属性。 | 
| MaintainTime | String | 否 | 是 | 集群的可维护时间。 | 格式:HH:mmZ-HH:mmZ。例如:16:00Z-17:00Z,表示0点到1点(UTC+08:00)可进行例行维护。 | 
| CreationOption | String | 否 | 否 | 创建方式。 | 创建方式,取值范围如下: 
 默认为 Normal。 说明  当 DBType 为 MySQL 且 DBVersion 为8.0时,本参数取值可以为 CreateGdnStandby。 | 
| VSwitchId | String | 否 | 否 | 交换机ID。 | 无 | 
| SecurityIPList | String | 否 | 否 | PolarDB集群白名单。 | 说明  支持配置多个白名单 IP 地址,多个 IP 地址之间使用英文逗号分隔。 | 
| CloneDataPoint | String | 否 | 否 | 克隆数据的时间节点。 | 取值: 
 说明  若 CreationOption 为 CloneFromRDS,则本参数取值只能为 LATEST。 | 
| CreationCategory | String | 否 | 否 | 集群系列。 | 产品系列,取值范围如下: 
 说明  MySQL 5.6、5.7、8.0,PostgreSQL 14 以及 Oracle 语法兼容 2.0 版支持 Basic。 MySQL 8.0支持 ArchiveNormal 和 NormalMultimaster。 MySQL 5.6、5.7、8.0和 PostgreSQL 14 支持 SENormal。 | 
| BackupRetentionPolicyOnClusterDeletion | String | 否 | 否 | 删除集群时备份集保留策略。 | 取值: 
 创建集群时,默认取值为 NONE,即集群删除时不保留备份集。 说明  
 | 
| ResourceGroupId | String | 否 | 是 | 资源组ID。 | 无 | 
| DefaultTimeZone | String | 否 | 否 | 集群时区(UTC)。 | 默认取值为SYSTEM,默认时区与Region所在时区一致。 可选取值范围为-12:00~+13:00内的所有整数时间点,如 00:00。 说明  仅当DBType取值为MySQL时,该参数生效。 | 
| GDNId | String | 否 | 否 | 全球数据库网络ID。 | 当CreationOption取值为CreateGdnStandby时,该参数必填。 | 
| LowerCaseTableNames | Integer | 否 | 否 | 表名是否区分大小写。 | 取值: 
 说明  仅当DBType为MySQL时,该参数生效。 | 
| DBClusterParameters | Map | 否 | 是 | PolarDB集群的参数。 | 更多信息,请参见DBClusterParameters属性。 | 
| DeletionProtection | Boolean | 否 | 是 | 是否开启删除保护。 | 取值: 
 | 
| TDEStatus | Boolean | 否 | 是 | 是否开启透明数据加密(TDE)。 | 取值: 
 说明  当DBType取值为PostgreSQL或DBType取值为Oracle时,该参数生效。 | 
| PeriodUnit | String | 否 | 是 | 时长单位。 | 取值: 
 | 
| ScaleRoNumMin | Integer | 否 | 否 | 只读节点数的最小扩容和缩容限制。 | 取值范围:0~15。 说明  仅 Serverless 集群支持该参数。 | 
| ScaleMax | Integer | 否 | 否 | 单节点扩容和缩容的最大限制。 | 取值范围:1 PCU~32 PCU。 说明  仅 Serverless 集群支持该参数。 | 
| AllowShutDown | Boolean | 否 | 否 | 是否开启无活动暂停。 | 取值: 
 说明  仅 Serverless 集群支持该参数。 | 
| ServerlessType | String | 否 | 否 | Serverless服务类型。 | 取值:AgileServerless。 说明  仅 Serverless 集群支持该参数。 | 
| ScaleRoNumMax | Integer | 否 | 否 | 只读节点数的最大扩容和缩容限制。 | 取值范围:0~15。 说明  仅 Serverless 集群支持该参数。 | 
| ScaleMin | Integer | 否 | 否 | 单节点扩容和缩容的最小限制。 | 取值范围:1 PCU~31 PCU。 说明  仅 Serverless 集群支持该参数。 | 
| SSLEnabled | String | 否 | 是 | 修改SSL状态。 | 取值: 
 | 
| StorageType | String | 否 | 否 | 存储类型。 | 企业版存储类型取值如下: 
 标准版存储类型取值如下: 
 | 
| LooseXEngine | String | 否 | 否 | 开启X-Engine存储引擎功能。 | 取值: 
 说明  当参数CreationOption不等于CreateGdnStandby,DBType为MySQL且DBVersion为8.0时,该参数才生效。开启X-Engine引擎的节点内存规格必须大于等于16 GB。 | 
| LoosePolarLogBin | String | 否 | 否 | 开启Binlog功能。 | 取值: 
 说明  当参数DBType为MySQL时,该参数才生效。 | 
| StorageSpace | Integer | 否 | 否 | 按空间计费(包年包月)的存储空间。 | 单位:GB。 说明  
 | 
| ProxyType | String | 否 | 否 | 数据库代理类型。 | 取值范围如下: 
 说明  代理类型需要与集群的节点规格对应的类型保持一致。即: 节点规格为通用规格,则代理类型应为企业通用版; 节点规格为独享规格,则代理类型应为企业独享版。 | 
| StandbyAZ | String | 否 | 否 | 存储热备集群的可用区。 | 适用于标准版3AZ场景。 说明  开启了多可用区数据强一致,该参数才生效。 | 
| LooseXEngineUseMemoryPct | Integer | 否 | 否 | 设置开启X-Engine存储引擎比例。 | 取值范围10~90的整数。 说明  当参数LooseXEngine为ON时,该参数才生效。 | 
| StorageUpperBound | Integer | 否 | 否 | 设置标准版集群存储自动扩容上限。 | 单位:GB。 说明  取值最大为32000。 | 
| StrictConsistency | String | 否 | 否 | 集群是否开启了多可用区数据强一致。 | 取值: 
 | 
| StoragePayType | String | 否 | 否 | 存储计费类型。 | 取值: 
 | 
| DBNodeNum | Integer | 否 | 否 | 标准版和企业版节点个数。 | 取值如下: 
 说明  
 | 
| ProxyClass | String | 否 | 否 | 标准版数据库代理规格。 | 取值: 
 | 
| HotStandbyCluster | String | 否 | 否 | 是否开启热备集群。 | 取值: 
 说明  标准版集群的默认值为STANDBY。 | 
| StorageAutoScale | String | 否 | 否 | 标准版集群是否开启存储自动扩容。 | 取值: 
 | 
| Architecture | String | 否 | 否 | CPU 架构。 | 取值: 
 | 
| DBMinorVersion | String | 否 | 否 | 数据库引擎小版本号。 | 取值: 
 说明  当参数 DBType 为 MySQL 且 DBVersion 为8.0时,该参数才生效。 | 
| VpcId | String | 否 | 否 | 专有网络ID。 | 无 | 
| ParameterGroupId | String | 否 | 否 | 参数模板ID。 | 您可以通过DescribeParameterGroups接口查看目标地域的参数模板列表,包括参数模板ID。 | 
| RestartMasterNode | Boolean | 否 | 否 | 是否重启主节点。 | 取值: 
 | 
| ColdStorageOption | Map | 否 | 否 | 冷数据归档选项。 | 更多信息,请参见ColdStorageOption属性。 | 
| ProvisionedIops | Integer | 否 | 否 | ESSD AutoPL 云盘预配置的读写 IOPS。 | 可能值:0~min{50,000, 1000*容量-基准性能}。 基准性能=min{1,800+50*容量, 50000}。 说明  当 StorageType 为 ESSDAUTOPL 时才支持该参数。 | 
Tags语法
"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  Tags属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Key | String | 是 | 否 | 标签键。 | 长度为1~128个字符,不能以 | 
| Value | String | 否 | 否 | 标签值。 | 长度为0~128个字符,不能以 | 
DBClusterParameters语法
"DBClusterParameters": {
  "Parameters": String,
  "EffectiveTime": String
}DBClusterParameters属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Parameters | String | 否 | 是 | 参数及其值的JSON字符串。 | 参数的值都是字符串类型。 | 
| EffectiveTime | String | 否 | 是 | 参数的生效时间。 | 取值: 
 | 
ColdStorageOption语法
"ColdStorageOption": {
  "Description": String,
  "Enable": Boolean
}ColdStorageOption属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Description | String | 否 | 否 | 描述信息。 | 如果设置了描述信息,则表示开启了冷数据归档功能。 长度不超过256个字符。 | 
| Enable | Boolean | 否 | 否 | 开启冷数据归档功能。 | 取值: 
 | 
返回值
Fn::GetAtt
- DBClusterId:集群ID。 
- OrderId:订单ID。 
- DBNodeIds:集群节点ID。 
- PrimaryEndpointId:主地址ID。 
- CustomEndpointIds:自定义集群地址ID。 
- CustomConnectionStrings:自定义连接串。 
- PrimaryConnectionString:主连接串。 
- ClusterConnectionString:自定义连接串。 
- ClusterEndpointId:集群地址ID。 
- PrimaryEndpointIds:集群主地址ID列表。 
- PrimaryConnectionStrings:集群主地址连接串列表。 
- ColdStorageInstanceId:冷数据库实例ID。 
- DBClusterDescription:集群描述。 
- Arn:阿里云资源名称。 
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VpcId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description:
      en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud
      zh-cn: 现有虚拟专有网络的实例ID
    Label:
      en: VPC ID
      zh-cn: 专有网络VPC实例ID
  VSwitchZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
      zh-cn: 交换机可用区
      en: VSwitch Availability Zone
    Label:
      zh-cn: 交换机可用区
      en: VSwitch Availability Zone
  VSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${VSwitchZoneId}
    Type: String
    Description:
      en: Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query
      zh-cn: 现有业务网络交换机的实例ID
    Label:
      en: VSwitch ID
      zh-cn: 交换机实例ID
  DBType:
    Type: String
    Description: |-
      Database type, value:
      MySQL
      PostgreSQL
      Oracle
    Default: MySQL
  DBVersion:
    Type: String
    Description: |-
      The version of the database. Valid values:
      MySQL: 5.6 or 8.0
      PostgreSQL: 11
      Oracle: 11
    Default: '5.6'
  DBNodeClass:
    Type: String
    Description: The node specifications of the cluster. For more information, see Specifications and pricing.
    Default: polar.mysql.x4.medium
Resources:
  DBCluster:
    Type: ALIYUN::POLARDB::DBCluster
    Properties:
      VpcId:
        Ref: VpcId
      DBType:
        Ref: DBType
      ClusterNetworkType: VPC
      ZoneId:
        Ref: VSwitchZoneId
      VSwitchId:
        Ref: VSwitchId
      DBVersion:
        Ref: DBVersion
      DBNodeClass:
        Ref: DBNodeClass
      PayType: Postpaid
Outputs:
  DBClusterId:
    Description: The ID of the ApsaraDB for POLARDB cluster.
    Value:
      Fn::GetAtt:
        - DBCluster
        - DBClusterId{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "en": "Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud",
        "zh-cn": "现有虚拟专有网络的实例ID"
      },
      "Label": {
        "en": "VPC ID",
        "zh-cn": "专有网络VPC实例ID"
      }
    },
    "VSwitchZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "交换机可用区",
        "en": "VSwitch Availability Zone"
      },
      "Label": {
        "zh-cn": "交换机可用区",
        "en": "VSwitch Availability Zone"
      }
    },
    "VSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${VSwitchZoneId}"
      },
      "Type": "String",
      "Description": {
        "en": "Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query",
        "zh-cn": "现有业务网络交换机的实例ID"
      },
      "Label": {
        "en": "VSwitch ID",
        "zh-cn": "交换机实例ID"
      }
    },
    "DBType": {
      "Type": "String",
      "Description": "Database type, value:\nMySQL\nPostgreSQL\nOracle",
      "Default": "MySQL"
    },
    "DBVersion": {
      "Type": "String",
      "Description": "The version of the database. Valid values:\nMySQL: 5.6 or 8.0\nPostgreSQL: 11\nOracle: 11",
      "Default": "5.6"
    },
    "DBNodeClass": {
      "Type": "String",
      "Description": "The node specifications of the cluster. For more information, see Specifications and pricing.",
      "Default": "polar.mysql.x4.medium"
    }
  },
  "Resources": {
    "DBCluster": {
      "Type": "ALIYUN::POLARDB::DBCluster",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "DBType": {
          "Ref": "DBType"
        },
        "ClusterNetworkType": "VPC",
        "ZoneId": {
          "Ref": "VSwitchZoneId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "DBVersion": {
          "Ref": "DBVersion"
        },
        "DBNodeClass": {
          "Ref": "DBNodeClass"
        },
        "PayType": "Postpaid"
      }
    }
  },
  "Outputs": {
    "DBClusterId": {
      "Description": "The ID of the ApsaraDB for POLARDB cluster.",
      "Value": {
        "Fn::GetAtt": [
          "DBCluster",
          "DBClusterId"
        ]
      }
    }
  }
}PolarDB PostgreSQL Serverless示例
ROSTemplateFormatVersion: '2015-09-01'
Resources:
  VPC:
    Type: ALIYUN::ECS::VPC
    Properties:
      VpcName: polardb-test
      CidrBlock: 192.168.0.0/16
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VSwitchName: polardb-test
      VpcId:
        Ref: VPC
      CidrBlock: 192.168.1.0/24
      ZoneId: cn-beijing-k
  PolardbCluster:
    Type: ALIYUN::POLARDB::DBCluster
    Properties:
      VpcId:
        Ref: VPC
      CreationCategory: Normal
      StorageType: PSL5
      DBType: PostgreSQL
      ClusterNetworkType: VPC
      DBVersion: '16'
      PayType: Postpaid
      ZoneId: cn-beijing-k
      VSwitchId:
        Ref: VSwitch
      DBNodeClass: polar.pg.sl.small
      SecurityIPList: 0.0.0.0/0
      ServerlessType: AgileServerless
      ScaleMin: 1
      ScaleMax: 3
      ScaleRoNumMin: 1
      ScaleRoNumMax: 2
      HotStandbyCluster: 'OFF'
  {
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "VPC": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "VpcName": "polardb-test",
        "CidrBlock": "192.168.0.0/16"
      }
    },
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VSwitchName": "polardb-test",
        "VpcId": {
          "Ref": "VPC"
        },
        "CidrBlock": "192.168.1.0/24",
        "ZoneId": "cn-beijing-k"
      }
    },
    "PolardbCluster": {
      "Type": "ALIYUN::POLARDB::DBCluster",
      "Properties": {
        "VpcId": {
          "Ref": "VPC"
        },
        "CreationCategory": "Normal",
        "StorageType": "PSL5",
        "DBType": "PostgreSQL",
        "ClusterNetworkType": "VPC",
        "DBVersion": "16",
        "PayType": "Postpaid",
        "ZoneId": "cn-beijing-k",
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "DBNodeClass": "polar.pg.sl.small",
        "SecurityIPList": "0.0.0.0/0",
        "ServerlessType": "AgileServerless",
        "ScaleMin": 1,
        "ScaleMax": 3,
        "ScaleRoNumMin": 1,
        "ScaleRoNumMax": 2,
        "HotStandbyCluster": "OFF"
      }
    }
  }
}更多示例,请参见创建PolarDB集群、为PolarDB数据库创建账号、在PolarDB集群下创建一个新的数据库、增加PolarDB集群节点、授权普通账号访问PolarDB集群的某个数据库、修改允许访问数据库集群的IP名单和创建PolarDB集群的公网地址的组合示例:YAML示例。