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
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
VpcId | String | 否 | 否 | 专有网络ID。 | 无 |
DBClusterDescription | String | 否 | 是 | 集群描述。 | 长度为2~256个字符。以英文字母或汉字开头,不能以http:// 或https:// 开头。可包含英文字母、汉字、数字、半角逗号(,)和短划线(-) 。 |
DBType | String | 是 | 否 | 数据库引擎类型。 | 取值:
|
ClusterNetworkType | String | 否 | 否 | 集群网络类型。 | 当前仅支持专有网络,取值:VPC。 |
RenewalStatus | String | 否 | 是 | 自动续费状态。 | 取值:
|
AutoRenewPeriod | Integer | 否 | 是 | 实例自动续费时长。 | 取值:
单位:月。 |
Period | Integer | 否 | 否 | 预付费类型(即PayType为Prepaid时)实例的时长。 | 取值:
单位:月。 |
ZoneId | String | 否 | 否 | 可用区ID。 | 您可以通过DescribeRegions接口查询可选的可用区。 |
SourceResourceId | String | 否 | 否 | 源RDS实例ID或源PolarDB集群ID。 | 当DBType取值为MySQL且DBVersion取值为5.6时,该参数有效。如果CreationOption值不等于Normal,该参数必填。 |
SecurityGroupIds | List | 否 | 是 | 安全组ID列表。 | 最多支持3个安全组。 |
Tags | List | 否 | 是 | 标签。 | 最多支持添加20个标签。 更多信息,请参见Tags属性。 |
MaintainTime | String | 否 | 是 | 集群的可维护时间。 | 格式:HH:mmZ-HH:mmZ。例如:16:00Z-17:00Z,表示0点到1点(UTC+08:00)可进行例行维护。 |
DBVersion | String | 是 | 否 | 数据库版本号。 | 取值:
|
CreationOption | String | 否 | 否 | 创建方式。 | 取值:
|
DBNodeClass | String | 是 | 否 | 节点规格。 | 更多信息,请参见计费项概览。 |
VSwitchId | String | 否 | 否 | 交换机ID。 | 无 |
SecurityIPList | String | 否 | 否 | PolarDB集群白名单。 | 无 |
CloneDataPoint | String | 否 | 否 | 克隆数据的时间节点。 | 取值:
|
PayType | String | 是 | 否 | 付费类型。 | 取值:
|
CreationCategory | String | 否 | 否 | 集群系列。 | 取值:Normal(标准版)。 |
BackupRetentionPolicyOnClusterDeletion | String | 否 | 否 | 删除集群时备份集保留策略。 | 取值:
说明 仅当DBType取值为MySQL时,该参数生效。 |
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属性。 |
TDEStatus | Boolean | 否 | 是 | 是否开启透明数据加密(TDE)。 | 取值:
说明 当DBType取值为PostgreSQL或DBType取值为Oracle时,该参数生效。 |
PeriodUnit | String | 否 | 否 | 时长单位。 | 取值:
|
ScaleRoNumMin | Integer | 否 | 否 | 只读节点数的最小扩容和缩容限制。 | 无 |
ScaleMax | Integer | 否 | 否 | 单节点扩容和缩容的最大限制。 | 无 |
AllowShutDown | Boolean | 否 | 否 | 是否开启无活动暂停。 | 取值:
|
ServerlessType | String | 否 | 否 | Serverless服务类型。 | 取值:AgileServerless。 |
ScaleRoNumMax | Integer | 否 | 否 | 只读节点数的最大扩容和缩容限制。 | 无 |
ScaleMin | Integer | 否 | 否 | 单节点扩容和缩容的最小限制。 | 无 |
Tags语法
"Tags": [
{
"Key": String,
"Value": String
}
]
Tags属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
Key | String | 是 | 否 | 标签键。 | 长度为1~128个字符,不能以aliyun 和acs: 开头,不能包含http:// 或者https:// 。 |
Value | String | 否 | 否 | 标签值。 | 长度为0~128个字符,不能以aliyun 和acs: 开头,不能包含http:// 或者https:// 。 |
DBClusterParameters语法
"DBClusterParameters": {
"Parameters": String,
"EffectiveTime": String
}
DBClusterParameters属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
Parameters | String | 否 | 是 | 参数及其值的JSON字符串。 | 参数的值都是字符串类型。 |
EffectiveTime | String | 否 | 是 | 参数的生效时间。 | 取值:
|
返回值
Fn::GetAtt
- DBClusterId:集群ID。
- OrderId:订单ID。
- DBNodeIds:集群节点ID。
- PrimaryEndpointId:主地址ID。
- CustomEndpointIds:自定义集群地址ID。
- CustomConnectionStrings:自定义连接串。
- PrimaryConnectionString:主连接串。
- ClusterConnectionString:自定义连接串。
- ClusterEndpointId:集群地址ID。
- PrimaryEndpointIds:集群主地址ID列表。
- PrimaryConnectionStrings:集群主地址连接串列表。
示例
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示例。