CreateClusters

Last updated: 2021-11-08 10:26:37

1. API Description

Domain name for API request: cynosdb.tencentcloudapi.com.

This API is used to create a cluster.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: CreateClusters.
Version Yes String Common parameter. The value used for this API: 2019-01-07.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
Zone Yes String AZ
VpcId Yes String VPC ID
SubnetId Yes String Subnet ID
DbType Yes String Database type. Valid values:
  • MYSQL
  • DbVersion Yes String Database version. Valid values:
  • Valid values for MYSQL: 5.7
  • ProjectId No Integer Project ID
    Cpu No Integer Number of CPU cores of normal instance
    Memory No Integer Memory of a non-serverless instance in GB
    Storage No Integer Storage capacity in GB
    ClusterName No String Cluster name
    AdminPassword No String Account password (it must contain 8-64 characters in at least three of the following four types: uppercase letters, lowercase letters, digits, and symbols (~!@#$%^&*_-+=`|(){}[]:;'<>,.?/).)
    Port No Integer Port. Default value: 5432
    PayMode No Integer Billing mode. 0: pay-as-you-go; 1: monthly subscription. Default value: 0
    Count No Integer Number of purchased items. Currently, only 1 can be passed in. If this parameter is left empty, 1 will be used by default.
    RollbackStrategy No String Rollback type:
    noneRollback: no rollback
    snapRollback: rollback by snapshot
    timeRollback: rollback by time point
    RollbackId No Integer snapshotId for snapshot rollback or queryId for time point rollback. 0 indicates to determine whether the time point is valid
    OriginalClusterId No String Pass in the source cluster ID during rollback to find the source poolId
    ExpectTime No String Specified time for time point rollback or snapshot time for snapshot rollback
    ExpectTimeThresh No Integer Specified allowed time range for time point rollback
    StorageLimit No Integer The maximum storage of a non-serverless instance in GB
    If DbType is MYSQL and the storage billing mode is prepaid, the parameter value cannot exceed the maximum storage corresponding to the CPU and memory specifications.
    InstanceCount No Integer Number of instances
    TimeSpan No Integer Purchase duration of monthly subscription plan
    TimeUnit No String Purchase duration unit of monthly subscription plan
    AutoRenewFlag No Integer Whether auto-renewal is enabled for monthly subscription plan
    AutoVoucher No Integer Whether to automatically select a voucher. 1: yes; 0: no. Default value: 0
    HaCount No Integer Number of instances (this parameter has been disused and is retained only for compatibility with existing instances)
    OrderSource No String Order source
    ResourceTags.N No Array of Tag Array of tags to be bound to the created cluster
    DbMode No String Database type
    Valid values when DbType is MYSQL (default value: NORMAL):
  • NORMAL
  • SERVERLESS
  • MinCpu No Float This parameter is required if DbMode is SERVERLESS
    Minimum number of CPU cores. For the value range, please see the returned result of DescribeServerlessInstanceSpecs
    MaxCpu No Float This parameter is required if DbMode is SERVERLESS:
    Maximum number of CPU cores. For the value range, please see the returned result of DescribeServerlessInstanceSpecs
    AutoPause No String This parameter specifies whether the cluster will be automatically paused if DbMode is SERVERLESS. Valid values:
  • yes
  • no

  • Default value: yes
    AutoPauseDelay No Integer This parameter specifies the delay for automatic cluster pause in seconds if DbMode is SERVERLESS. Value range: [600,691200]
    Default value: 600
    StoragePayMode No Integer The billing mode of cluster storage. Valid values: 0 (postpaid), 1 (prepaid). Default value: 0.
    If DbType is MYSQL and the billing mode of cluster compute is pay-as-you-go (or the DbMode is SERVERLESS), the billing mode of cluster storage must be postpaid.
    Clusters with storage billed in prepaid mode cannot be cloned or rolled back.
    SecurityGroupIds.N No Array of String Array of security group IDs
    AlarmPolicyIds.N No Array of String Array of alarm policy IDs
    ClusterParams.N No Array of ParamItem Array of parameters
    DealMode No Integer Transaction mode. Valid values: 0 (place and pay for an order), 1 (place an order)
    ParamTemplateId No Integer Parameter template ID

    3. Output Parameters

    Parameter Name Type Description
    TranId String Freezing transaction ID
    Note: this field may return null, indicating that no valid values can be obtained.
    DealNames Array of String Order ID
    Note: this field may return null, indicating that no valid values can be obtained.
    ResourceIds Array of String List of resource IDs (This field has been deprecated. Please use dealNames in the DescribeResourcesByDealName API to get resource IDs.)
    Note: this field may return null, indicating that no valid values can be obtained.
    ClusterIds Array of String List of cluster IDs (This field has been deprecated. Please use dealNames in the DescribeResourcesByDealName API to get cluster IDs.)
    Note: this field may return null, indicating that no valid values can be obtained.
    BigDealIds Array of String Big order ID.
    Note: this field may return null, indicating that no valid values can be obtained.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Creating a cluster

    Input Example

    https://cynosdb.tencentcloudapi.com/?Action=CreateClusters
    &Zone=ap-guangzhou-3
    &ProjectId=0
    &VpcId=vpc-1ptuei0b
    &SubnetId=subnet-1tmw9t4o
    &DbType=POSTGRESQL
    &DbVersion=10.0
    &Cpu=2
    &Memory=4
    &Storage=100
    &ClusterName=newInstance
    &AdminPassword=passwd@admin
    &HaCount=1
    &Count=1
    &PayMode=0
    &StoragePayMode=0
    &RollbackStrategy=noneRollback
    &StorageLimit=100
    &<Common request parameters>
    

    Output Example

    {
      "Response": {
        "ResourceIds": [
          "cynosdbpg-ins-67rmucgk"
        ],
        "RequestId": "132075",
        "TranId": "20190522160000003106844584180998",
        "ClusterIds": [
          "cynosdbmysql-sls-9nts65r2"
        ],
        "BigDealIds": [
          "xxx"
        ],
        "DealNames": [
          "20190522112283"
        ]
      }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation.CreateOrder Failed to create the order and make a payment.
    FailedOperation.InsufficientBalance Insufficient account balance.
    FailedOperation.TradeCreateOrderError Failed to create the order and make a payment. Please try again later. If the problem persists, please contact customer service.
    InternalError.DbOperationFailed Failed to query the database.
    InternalError.GetSubnetFailed Failed to get the subnet.
    InternalError.GetVpcFailed Failed to get the VPC.
    InternalError.InternalHttpServerError
    InternalError.UnknownError Unknown internal error.
    InvalidParameterValue.DBTypeNotFound Unsupported instance type.
    InvalidParameterValue.IllegalPassword The password does not meet the requirement.
    InvalidParameterValue.InvalidDBVersion Invalid instance version.
    InvalidParameterValue.InvalidParameterValueError Invalid parameter value.
    InvalidParameterValue.InvalidSpec Invalid instance specification.
    InvalidParameterValue.InvalidZoneIdError Invalid availability zone ({{1}}).
    InvalidParameterValue.RegionZoneUnavailable The selected region and AZ are unavailable.
    InvalidParameterValue.SubnetNotFound The selected subnet could not be found.
    InvalidParameterValue.VpcNotFound The selected VPC could not be found.
    LimitExceeded.UserInstanceLimit The number of instances exceeds the limit.
    OperationDenied.InsufficientBalanceError Insufficient account balance.
    OperationDenied.UserNotAuthenticatedError You need to verify your identity to make a purchase.
    UnauthorizedOperation.NotRealNameAccount Users who haven't completed identity verification cannot make purchases.
    UnauthorizedOperation.PermissionDenied CAM authentication failed.