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
  }
}

属性

属性名称类型必须允许更新描述约束
VpcIdString专有网络ID。
DBClusterDescriptionString集群描述。长度为2~256个字符。以英文字母或汉字开头,不能以http://https://开头。可包含英文字母、汉字、数字、半角逗号(,)和短划线(-) 。
DBTypeString数据库引擎类型。取值:
  • MySQL
  • PostgreSQL
  • Oracle
ClusterNetworkTypeString集群网络类型。当前仅支持专有网络,取值:VPC。
RenewalStatusString自动续费状态。取值:
  • AutoRenewal:自动续费。
  • Normal(默认值):手动续费。
  • NotRenewal:不再续费。
    说明 设置为NotRenewal后,系统不再发送到期提醒,只在到期前第三天发送不续费提醒。
AutoRenewPeriodInteger实例自动续费时长。取值:
  • 1(默认值)
  • 2
  • 3
  • 6
  • 12
  • 24
  • 36

单位:月。

PeriodInteger预付费类型(即PayType为Prepaid时)实例的时长。取值:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 12
  • 24
  • 36

单位:月。

ZoneIdString可用区ID。您可以通过DescribeRegions接口查询可选的可用区。
SourceResourceIdString源RDS实例ID或源PolarDB集群ID。当DBType取值为MySQL且DBVersion取值为5.6时,该参数有效。如果CreationOption值不等于Normal,该参数必填。
SecurityGroupIdsList安全组ID列表。最多支持3个安全组。
TagsList标签。最多支持添加20个标签。

更多信息,请参见Tags属性

MaintainTimeString集群的可维护时间。格式:HH:mmZ-HH:mmZ。例如:16:00Z-17:00Z,表示0点到1点(UTC+08:00)可进行例行维护。
DBVersionString数据库版本号。取值:
  • 当DBType取值为MySQL时:5.6、8.0。
  • 当DBType取值为PostgreSQL时:11。
  • 当DBType取值为Oracle时:11。
CreationOptionString创建方式。取值:
  • Normal(默认值):创建一个全新的PolarDB集群。
  • CloneFromPolarDB:从现有PolarDB集群克隆数据到新的PolarDB集群。
  • CloneFromRDS:从现有RDS实例克隆数据到新的PolarDB集群。
  • MigrationFromRDS:从现有RDS实例迁移数据到新的PolarDB集群。
当DBType取值为MySQL且DBVersion取值为5.6时,该参数取值为CloneFromRDS或MigrationFromRDS。
DBNodeClassString节点规格。

更多信息,请参见计费项概览

VSwitchIdString交换机ID。
SecurityIPListStringPolarDB集群白名单。
CloneDataPointString克隆数据的时间节点。取值:
  • LATEST(默认值):最新时间点的数据。
    说明 当CreationOption取值为CloneFromRDS时,该参数取值为LATEST。
  • BackupID:历史备份集ID。
  • Timestamp:历史时间点,格式:yyyy-MM-ddTHH:mm:ssZ(UTC时间)。
当DBType取值为MySQL且DBVersion取值为5.6,并且CreationOption取值为CloneFromRDS或CloneFromPolarDB时,该参数有效。
PayTypeString付费类型。取值:
  • Postpaid:按量付费。
  • Prepaid:预付费(包年包月)。
CreationCategoryString集群系列。取值:Normal(标准版)。
BackupRetentionPolicyOnClusterDeletionString删除集群时备份集保留策略。取值:
  • ALL:永久保留全部备份。
  • LATEST:永久保留最后一个备份(删除前自动备份)。
  • NONE(默认值):集群删除时不保留备份集。
说明 仅当DBType取值为MySQL时,该参数生效。
ResourceGroupIdString资源组ID。
DefaultTimeZoneString集群时区(UTC)。

默认取值为SYSTEM,默认时区与Region所在时区一致。

可选取值范围为-12:00~+13:00内的所有整数时间点,如 00:00。

说明 仅当DBType取值为MySQL时,该参数生效。
GDNIdString全球数据库网络ID。当CreationOption取值为CreateGdnStandby时,该参数必填。
LowerCaseTableNamesInteger表名是否区分大小写。取值:
  • 1(默认值):不区分大小写。
  • 0:区分大小写。
说明 仅当DBType为MySQL时,该参数生效。
DBClusterParametersMapPolarDB集群的参数。更多信息,请参见DBClusterParameters属性
TDEStatusBoolean是否开启透明数据加密(TDE)。取值:
  • true:开启。
    说明 TDE功能开启后不可关闭。
  • false(默认值):关闭。
说明 当DBType取值为PostgreSQL或DBType取值为Oracle时,该参数生效。
PeriodUnitString时长单位。取值:
  • Year:年。
  • Month:月。
ScaleRoNumMinInteger只读节点数的最小扩容和缩容限制。
ScaleMaxInteger单节点扩容和缩容的最大限制。
AllowShutDownBoolean是否开启无活动暂停。取值:
  • true:开启无活动暂停。
  • false:关闭无活动暂停。
ServerlessTypeStringServerless服务类型。取值:AgileServerless。
ScaleRoNumMaxInteger只读节点数的最大扩容和缩容限制。
ScaleMinInteger单节点扩容和缩容的最小限制。

Tags语法

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

Tags属性

属性名称类型必须允许更新描述约束
KeyString标签键。长度为1~128个字符,不能以aliyunacs:开头,不能包含http://或者https://
ValueString标签值。长度为0~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

DBClusterParameters语法

"DBClusterParameters": {
  "Parameters": String,
  "EffectiveTime": String
}

DBClusterParameters属性

属性名称类型必须允许更新描述约束
ParametersString参数及其值的JSON字符串。参数的值都是字符串类型。
EffectiveTimeString参数的生效时间。取值:
  • Auto:自动确定何时生效。
  • Immediately:立即生效。
  • MaintainTime:集群维护期间生效。

返回值

Fn::GetAtt

  • DBClusterId:集群ID。
  • OrderId:订单ID。
  • DBNodeIds:集群节点ID。
  • PrimaryEndpointId:主地址ID。
  • CustomEndpointIds:自定义集群地址ID。
  • CustomConnectionStrings:自定义连接串。
  • PrimaryConnectionString:主连接串。
  • ClusterConnectionString:自定义连接串。
  • ClusterEndpointId:集群地址ID。
  • PrimaryEndpointIds:集群主地址ID列表。
  • PrimaryConnectionStrings:集群主地址连接串列表。

示例

  • YAML格式

    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
  • JSON格式

    {
      "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集群、为PolarDB数据库创建账号、在PolarDB集群下创建一个新的数据库、增加PolarDB集群节点、授权普通账号访问PolarDB集群的某个数据库、修改允许访问数据库集群的IP名单和创建PolarDB集群的公网地址的组合示例:JSON示例YAML示例