CreateDBCluster

更新时间:
复制 MD 格式

Creates a db cluster.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

polardb:CreateDBCluster

create

*DBCluster

acs:polardb:{#regionId}:{#accountId}:dbcluster/{#DbClusterId}

  • polardb:EncryptionRequired
None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID.

Note

You can call the DescribeRegions operation to query available regions.

cn-hangzhou

ZoneId

string

No

The zone ID.

Note

You can call the DescribeRegions operation to query available zones.

cn-hangzhou-j

Architecture

string

No

The CPU architecture. Valid values:

  • X86

  • ARM

X86

DBType

string

Yes

The database engine. Valid values:

  • MySQL

  • PostgreSQL

  • Oracle

MySQL

DBVersion

string

Yes

The version of the database engine.

  • Valid values for MySQL:
    • 5.6

    • 5.7

    • 8.0

  • Valid values for PostgreSQL:
    • 11

    • 14

    • 15

Note

If you create a serverless cluster for PolarDB for PostgreSQL, you must set this parameter to 14.

* Valid values for Oracle: * 11 * 14

5.6

DBNodeClass

string

No

The node specification. For more information, see the following topics:

Note
  • To create a PolarDB for MySQL Cluster Edition serverless cluster, set this parameter to polar.mysql.sl.small.

  • To create a PolarDB for MySQL Standard Edition serverless cluster, set this parameter to polar.mysql.sl.small.c.

  • To create a PolarDB for PostgreSQL Cluster Edition serverless cluster, set this parameter to polar.pg.sl.small.

  • To create a PolarDB for PostgreSQL Standard Edition serverless cluster, set this parameter to polar.pg.sl.small.c.

  • To create a PolarDB for PostgreSQL (compatible with Oracle) serverless cluster, set this parameter to polar.o.sl.small.

polar.mysql.x4.medium

ClusterNetworkType

string

No

The network type of the cluster. Only VPC is supported.

VPC

DBClusterDescription

string

No

The description of the cluster. The description must meet the following requirements:

  • It cannot start with http:// or https://.

  • It must be 2 to 256 characters in length.

test

PayType

string

Yes

The billing method. Valid values:

  • Postpaid: pay-as-you-go.

  • Prepaid: subscription.

Postpaid

AutoRenew

boolean

No

Specifies whether to enable auto-renewal. Valid values:

  • true: enables auto-renewal.

  • false: disables auto-renewal.

Default value: false.

Note

This parameter takes effect only when PayType is set to Prepaid.

true

Period

string

No

The unit of the subscription duration. This parameter is required if you set the PayType parameter to Prepaid. Valid values:

  • Year: The subscription duration is measured in years.

  • Month: The subscription duration is measured in months.

Month

UsedTime

string

No

The subscription duration. This parameter is required if you set the PayType parameter to Prepaid.

  • If Period is set to Month, UsedTime must be an integer from [1-9].

  • If Period is set to Year, UsedTime must be an integer from [1-3].

1

VPCId

string

No

The ID of the VPC.

vpc-**********

VSwitchId

string

No

The ID of the VSwitch.

Note

If you specify the VPCId parameter, you must also specify this parameter.

vsw-**********

CreationOption

string

No

The method to create the cluster. Valid values:

Default value: Normal.

Note

If DBType is set to MySQL and DBVersion is set to 8.0, you can set this parameter to CreateGdnStandby.

Normal

SourceResourceId

string

No

The ID of the source ApsaraDB RDS instance or source PolarDB cluster. This parameter is required only if CreationOption is set to MigrationFromRDS, CloneFromRDS, CloneFromPolarDB, or RecoverFromRecyclebin.

  • If CreationOption is set to MigrationFromRDS or CloneFromRDS, specify the ID of the source ApsaraDB RDS instance. The source ApsaraDB RDS instance must be ApsaraDB RDS for MySQL 5.6, 5.7, or 8.0 High-availability Edition.

  • If CreationOption is set to CloneFromPolarDB, specify the ID of the source PolarDB cluster. The new cluster must use the same database engine as the source cluster. For example, if the source cluster runs MySQL 8.0, you must set DBType to MySQL and DBVersion to 8.0 for the new cluster.

  • If CreationOption is set to RecoverFromRecyclebin, specify the ID of the released source PolarDB cluster. The restored cluster must use the same database engine as the source cluster. For example, if the source cluster runs MySQL 8.0, you must set DBType to MySQL and DBVersion to 8.0 for the restored cluster.

rm-*************

CloneDataPoint

string

No

The point in time for the clone. Valid values:

  • LATEST: The latest point in time.

  • BackupID: The ID of a historical backup set.

  • Timestamp: A specific point in time in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

Default value: LATEST.

Note

If you set CreationOption to CloneFromRDS, you can set this parameter only to LATEST.

LATEST

ClientToken

string

No

A client-generated token that ensures the idempotence of the request. This token must be unique across all requests and is case-sensitive. It can contain up to 64 ASCII characters.

6000170000591aed949d0f5********************

ResourceGroupId

string

No

The ID of the resource group.

rg-************

SecurityIPList

string

No

The IP whitelist of the PolarDB cluster.

Note

You can specify multiple IP addresses in the IP whitelist. Separate the IP addresses with commas (,).

10.***.***.***

TDEStatus

boolean

No

Specifies whether to enable transparent data encryption (TDE). Valid values:

  • true: enables TDE.

  • false (default): disables TDE.

Note
  • This parameter is valid only when DBType is set to PostgreSQL or Oracle.

  • You can call the ModifyDBClusterTDE operation to enable TDE for a PolarDB for MySQL cluster.

  • TDE cannot be disabled after it is enabled.

true

GDNId

string

No

The ID of the Global Database Network (GDN).

Note

This parameter is required if CreationOption is set to CreateGdnStandby.

gdn-***********

CreationCategory

string

No

The edition of the cluster. Valid values:

  • Normal: Cluster Edition (default)

  • Basic: Single-node Edition

  • ArchiveNormal: X-Engine Edition

  • NormalMultimaster: Multi-master Cluster Edition

  • SENormal: Standard Edition

Note
  • The Basic edition is supported for PolarDB for MySQL 5.6, 5.7, and 8.0; PolarDB for PostgreSQL 14; and PolarDB for PostgreSQL (compatible with Oracle) 2.0.

  • The ArchiveNormal and NormalMultimaster editions are supported for PolarDB for MySQL 8.0.

  • The SENormal edition is supported for PolarDB for MySQL 5.6, 5.7, and 8.0 and PolarDB for PostgreSQL 14.

For more information about product editions, see Editions.

Normal

DefaultTimeZone

string

No

Cluster time zone (UTC). The value can be any full-hour offset from -12:00 to +13:00, such as 00:00. The default value is SYSTEM, which uses the region's time zone.

Note

This parameter takes effect only when DBType is MySQL.

SYSTEM

LowerCaseTableNames

string

No

The time zone of the cluster. The value must be a UTC offset in the ±HH:mm format. Valid values: from -12:00 to +13:00 on the hour. For example, 00:00. The default value SYSTEM indicates that the cluster uses the time zone of its region.

  • 1: Case-insensitive

  • 0: Case-sensitive

The default value is 1.

Note

This parameter is valid only if DBType is set to MySQL.

1

BackupRetentionPolicyOnClusterDeletion

string

No

The backup retention policy to apply when the cluster is deleted. Valid values:

  • ALL: retains all backup sets.

  • LATEST: retains only the last backup set. An automatic backup is performed before the cluster is deleted.

  • NONE: does not retain backup sets.

Default value: NONE.

Note
  • This parameter is valid only if DBType is set to MySQL.

  • Serverless clusters do not support this parameter.

NONE

StorageSpace

integer

No

The storage space for a pay-by-space (subscription) cluster. Unit: GB.

Note
  • Valid values for a PolarDB for MySQL Enterprise Edition cluster: 10 to 50000.

  • Valid values for a PolarDB for MySQL Standard Edition cluster: 20 to 64000.

  • If the storage type of a Standard Edition cluster is ESSD AutoPL, the storage space must be a multiple of 10 between 40 and 64000.

50

DBMinorVersion

string

No

The minor version of the database engine. Valid values:

  • 8.0.2

  • 8.0.1

Note

This parameter is valid only if DBType is set to MySQL and DBVersion is set to 8.0.

8.0.1

ParameterGroupId

string

No

The ID of the parameter template.

Note

You can call the DescribeParameterGroups operation to query the parameter templates in a specific region, including the IDs of the parameter templates.

pcpg-**************

Tag

array<object>

No

The tags to add to the cluster.

object

No

Key

string

No

The key of the tag.

Note

You can add up to 20 tags at a time. The Nth tag is a key-value pair, where Tag.N.Key is the key and Tag.N.Value is the value.

type

Value

string

No

The value of the tag.

Note

You can add up to 20 tags at a time. The Nth tag is a key-value pair, where Tag.N.Key is the key and Tag.N.Value is the value.

test

ServerlessType

string

No

The type of the serverless cluster. Set the value to AgileServerless.

Note

This parameter is supported only for serverless clusters.

AgileServerless

ScaleMin

string

No

The minimum number of PolarDB compute units (PCUs) for a single-node serverless cluster to scale down to. Valid values: 1 to 31.

Note

This parameter is supported only for serverless clusters.

1

ScaleMax

string

No

The maximum number of PCUs for a single-node serverless cluster to scale up to. Valid values: 1 to 32.

Note

This parameter is supported only for serverless clusters.

3

AllowShutDown

string

No

Specifies whether to enable pause on inactivity. Valid values:

  • true: enables pause on inactivity.

  • false (default): disables pause on inactivity.

Note

This parameter is supported only for serverless clusters.

true

ScaleRoNumMin

string

No

The minimum number of read-only nodes that the serverless cluster scales down to. Valid values: 0 to 15.

Note

This parameter is supported only for serverless clusters.

2

ScaleRoNumMax

string

No

The maximum number of read-only nodes that the serverless cluster scales up to. Valid values: 0 to 15.

Note

This parameter is supported only for serverless clusters.

4

StorageType

string

No

Valid values for Enterprise Edition:

  • PSL5

  • PSL4

Valid values for Standard Edition:

  • ESSDPL0

  • ESSDPL1

  • ESSDPL2

  • ESSDPL3

  • ESSDAUTOPL

PSL4

DBNodeNum

integer

No

The number of nodes for a Standard Edition or Enterprise Edition cluster. Valid values:

  • Standard Edition: 1 to 8. A cluster of this edition includes one read/write node and up to seven read-only nodes.

  • Enterprise Edition: 1 to 16. A cluster of this edition includes one read/write node and up to 15 read-only nodes.

Note
  • By default, an Enterprise Edition cluster has two nodes and a Standard Edition cluster has one node.

  • This parameter is supported only for PolarDB for MySQL.

  • You cannot change the number of nodes in a Multi-master Cluster Edition cluster.

1

HotStandbyCluster

string

No

Specifies whether to enable the hot standby cluster feature. Valid values:

  • ON (default): enables a hot standby storage cluster.

  • OFF: disables the hot standby cluster feature.

  • STANDBY: enables a hot standby cluster.

  • EQUAL: enables hot standby for both storage and computing resources.

  • 3AZ: enables multi-AZ strong consistency.

Note

The value STANDBY is valid only for PolarDB for PostgreSQL.

ON

StrictConsistency

string

No

Specifies whether to enable multi-AZ strong consistency for the cluster. Valid values:

  • ON: enables multi-AZ strong consistency. This feature is applicable to Standard Edition clusters that are deployed across three zones.

  • OFF: disables multi-AZ strong consistency.

ON

StandbyAZ

string

No

The zone for the hot standby cluster.

Note

This parameter is valid only when the hot standby cluster feature or multi-AZ strong consistency is enabled.

cn-hangzhou-g

ProxyType

string

No

The type of the database proxy. Valid values:

  • EXCLUSIVE: Enterprise Dedicated

  • GENERAL: Enterprise General-purpose

Note

The proxy type must be consistent with the type that corresponds to the node specification of the cluster:

  • If the node specification is general-purpose, the proxy type must be Enterprise General-purpose.

  • If the node specification is dedicated, the proxy type must be Enterprise Dedicated.

Exclusive

ProxyClass

string

No

The specification of the database proxy for a Standard Edition cluster. Valid values:

  • polar.maxscale.g2.medium.c: 2 cores

  • polar.maxscale.g2.large.c: 4 cores

  • polar.maxscale.g2.xlarge.c: 8 cores

  • polar.maxscale.g2.2xlarge.c: 16 cores

  • polar.maxscale.g2.3xlarge.c: 24 cores

  • polar.maxscale.g2.4xlarge.c: 32 cores

  • polar.maxscale.g2.8xlarge.c: 64 cores

polar.maxscale.g2.medium.c

LoosePolarLogBin

string

No

Specifies whether to enable binary logging. Valid values:

  • ON: enables binary logging.

  • OFF: disables binary logging.

Note

This parameter is valid only if DBType is set to MySQL.

ON

LooseXEngine

string

No

Specifies whether to enable the X-Engine storage engine. Valid values:

  • ON: enables the X-Engine storage engine.

  • OFF: disables the X-Engine storage engine.

Note

This parameter is valid only if the CreationOption parameter is not set to CreateGdnStandby, DBType is set to MySQL, and DBVersion is set to 8.0. To enable the X-Engine storage engine, the node must have at least 8 GB of memory.

ON

LooseXEngineUseMemoryPct

string

No

The percentage of memory allocated to the X-Engine storage engine. Valid values: integers from 10 to 90.

Note

This parameter is valid only if LooseXEngine is set to ON.

50

StoragePayType

string

No

The billing method for storage. Valid values:

  • Postpaid: pay-by-capacity (a pay-as-you-go method).

  • Prepaid: pay-by-space (a subscription method).

Prepaid

StorageAutoScale

string

No

Specifies whether to enable automatic storage scaling for a Standard Edition cluster. Valid values:

  • Enable: enables automatic storage scaling.

  • Disable: disables automatic storage scaling.

Enable

StorageUpperBound

integer

No

The maximum storage capacity for a Standard Edition cluster when automatic storage scaling is enabled. Unit: GB.

Note

The maximum value is 32000.

800

ProvisionedIops

integer

No

The provisioned read/write IOPS of the ESSD AutoPL cloud disk. Valid values: 0 to min{50,000, 1,000 × Capacity - Baseline IOPS}.

Baseline IOPS = min{1,800 + 50 × Capacity, 50,000}.

Note This parameter is supported only when StorageType is set to ESSDAUTOPL.

1000

BurstingEnabled

string

No

Specifies whether to enable the performance burst feature for the ESSD AutoPL cloud disk. Valid values:

  • true: enables the performance burst feature.

  • false (default): disables the performance burst feature.

Note

This parameter is supported only when StorageType is set to ESSDAUTOPL.

false

TargetMinorVersion

string

No

The target minor engine version.

8.0.1.1.54

StorageEncryption

boolean

No

Specifies whether to enable cloud disk encryption. Valid values:

  • true: enables cloud disk encryption.

  • false (default): disables cloud disk encryption.

Note

This parameter is valid only if DBType is set to MySQL.

Note

This parameter is valid only if StorageType is set to a Standard Edition storage type.

StorageEncryptionKey

string

No

The ID of a custom key from Key Management Service (KMS) for cloud disk encryption. The key must be in the same region as the cluster. If you specify this parameter, cloud disk encryption is automatically enabled and cannot be disabled. If this parameter is empty, the default service key is used.

You can view the key ID or create a new key in the Key Management Service (KMS) console.

Note

This parameter is valid only if DBType is set to MySQL.

Note

This parameter is valid only if StorageType is set to a Standard Edition storage type.

1022xxxxxxxx

SourceUid

integer

No

The UID of the source backup set owner in cross-account backup and restoration scenarios.

1022xxxxxxxx

CloudProvider

string

No

The cloud service provider of the instance.

ENS

EnsRegionId

string

No

The ID of the Edge Node Service (ENS) node. This parameter is required if you want to create an ENS database instance.

vn-hanoi-3

AutoUseCoupon

boolean

No

Specifies whether to automatically use a coupon. Valid values:

  • true (default): Automatically uses a coupon.

  • false: does not use a coupon.

true

PromotionCode

string

No

The promotion code. If you do not specify this parameter, the default coupon is used.

727xxxxxx934

Response elements

Element

Type

Description

Example

object

DBClusterId

string

The cluster ID.

pc-bp1s826a1up******

OrderId

string

The order ID.

211454967******

RequestId

string

The request ID.

E56531A4-E552-40BA-9C58-137B80******

ResourceGroupId

string

The resource group ID.

rg-***************

Examples

Success response

JSON format

{
  "DBClusterId": "pc-bp1s826a1up******",
  "OrderId": "211454967******",
  "RequestId": "E56531A4-E552-40BA-9C58-137B80******",
  "ResourceGroupId": "rg-***************"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidBackupRetentionPolicyOnClusterDeletion.Malformed The specified BackupRetentionPolicyOnClusterDeletion is invalid. The specified BackupRetentionPolicyOnClusterDeletion parameter is invalid.
400 InvalidLowerCaseTableNames.Malformed The specified LowerCaseTableNames is invalid. The specified LowerCaseTableNames parameter is invalid.
400 InvalidDefaultTimeZone.Malformed The specified DefaultTimeZone is invalid. The specified DefaultTimeZone parameter is invalid.
400 Location.FailedGetSubDomain The specified regionId does not match the zoneId or the zoneId does not exist. The specified region ID or zone ID is invalid or the specified zone ID does not exist.
400 MissParameter.GDNId The GDNId parameter is required. The GDNId parameter is required.
400 EntityNotExist.ResourceGroup The resource group does not exist.. The resource group does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.