tencent cloud

Feedback

CloneDBInstance

Last updated: 2023-12-11 16:33:19

    1. API Description

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

    This API is used to clone an instance by specifying a backup set or a point in time.

    A maximum of 100 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 Params. The value used for this API: CloneDBInstance.
    Version Yes String Common Params. The value used for this API: 2017-03-12.
    Region No String Common Params. This parameter is not required for this API.
    DBInstanceId Yes String ID of the original instance to be cloned.
    SpecCode Yes String Purchasable code, which can be obtained from the SpecCode field in the return value of the DescribeClasses API.
    Storage Yes Integer Instance storage capacity in GB.
    Period Yes Integer Validity period in months. Valid values:
  • Monthly subscription: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
  • Pay-as-you-go: 1.
  • AutoRenewFlag Yes Integer Auto-renewal flag. Valid values:
  • 0: Manual renewal.
  • 1: Automatic renewal.
    Default value: 0.
  • VpcId Yes String VPC ID in the format of vpc-xxxxxxx, which can be obtained in the console or from the unVpcId field in the return value of the DescribeVpcEx API.
    SubnetId Yes String VPC subnet ID in the format of subnet-xxxxxxxx, which can be obtained in the console or from the unSubnetId field in the return value of the DescribeSubnets API.
    Name No String Name of the newly purchased instance, which can contain up to 60 letters, digits, or symbols (-_). If this parameter is not specified, "Unnamed" will be displayed by default.
    InstanceChargeType No String Instance billing mode. Valid values:
  • PREPAID: Monthly subscription.
  • POSTPAID_BY_HOUR: Pay-as-you-go.
    Default value: PREPAID.
  • SecurityGroupIds.N No Array of String Security group of the instance, which can be obtained from the sgld field in the return value of the DescribeSecurityGroups API. If this parameter is not specified, the default security group will be bound.
    ProjectId No Integer Project ID.
    TagList.N No Array of Tag The information of tags to be bound with the instance, which is left empty by default. This parameter can be obtained from the Tags field in the return value of the DescribeTags API.
    DBNodeSet.N No Array of DBNode Deployment information of the instance node, which will display the information of each AZ when the instance node is deployed across multiple AZs.
    The information of AZ can be obtained from the Zone field in the return value of the DescribeZones API.
    AutoVoucher No Integer Whether to use vouchers automatically. Valid values:
  • 0: No.
  • 1: Yes.
    Default value: 0.
  • VoucherIds No String Voucher ID list.
    ActivityId No Integer Campaign ID.
    BackupSetId No String Basic backup set ID.
    RecoveryTargetTime No String Restoration point in time.
    SyncMode No String Primary-standby sync mode. Valid values:
  • Semi-sync
  • Async
    Default value for the primary instance: Semi-sync.
    Default value for the standby instance: Async.
  • 3. Output Parameters

    Parameter Name Type Description
    DealName String Order ID.
    Note: this field may return null, indicating that no valid values can be obtained.
    BillId String Bill ID.
    Note: this field may return null, indicating that no valid values can be obtained.
    DBInstanceId String ID of the cloned instance, which will be returned only when the instance is pay-as-you-go.
    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 Cloning u200dan instance

    This example shows you how to use the clone instance to restore data when it is deleted from the original instance by mistake.

    Input Example

    POST / HTTP/1.1
    Host: postgres.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CloneDBInstance
    <Common request parameters>
    
    {
        "VpcId": "vpc-2ot3acw1",
        "AutoRenewFlag": "1",
        "DBInstanceId": "postgres-abcd1234",
        "RecoveryTargetTime": "2021-12-25 01:27:35",
        "Storage": "10",
        "Period": "1",
        "AutoVoucher": "0",
        "InstanceChargeType": "prepaid",
        "SpecCode": "cdb.pg.z1.2g",
        "SubnetId": "subnet-ppv9iw34",
        "DBNodeSet": [
            {
                "Role": "Standby",
                "Zone": "ap-guangzhou-3"
            },
            {
                "Role": "Primary",
                "Zone": "ap-guangzhou-3"
            }
        ]
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "6ace8140-6b9e-4e81-a8ad-ef3f92b2aa90",
            "DealName": "20211225711000768276461",
            "BillId": "20211225711000768276471",
            "DBInstanceId": "postgres-xxxx"
        }
    }
    

    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
    AuthFailure.UnauthorizedOperation Authentication failed.
    FailedOperation.AllocateQuotasError Failed to request a quota for resource tags.
    FailedOperation.CamAuthFailed CAM authentication failed.
    FailedOperation.CamSigAndAuthError Authentication failed. Please try again later. If the problem persists, please contact customer service.
    FailedOperation.CdbCgwConnectError Failed to get project information. Please try again later. If the problem persists, please contact customer service.
    FailedOperation.DatabaseAccessError Failed to access database management service. Please try again later. If the problem persists, please contact customer service.
    FailedOperation.FailedOperationError Operation failed. Please try again later.
    FailedOperation.GetSubnetError Failed to query VPC subnets.
    FailedOperation.GetVpcInfoError Failed to query VPC information. Please try again later. If the problem persists, please contact customer service.
    FailedOperation.QuerySpecError Failed to query specifications. Please try again later. If the problem persists, please contact customer service.
    FailedOperation.QueryVpcFailed Failed to query VPC.
    FailedOperation.QueryVpcFalied Failed to get VPC details.
    InternalError.InternalHttpServerError An exception occurred while executing the request.
    InvalidParameter.ParameterCheckError Failed to check the parameter.
    InvalidParameterValue.IllegalProjectId Invalid ProjectId.
    InvalidParameterValue.IllegalRegion Invalid Region parameter.
    InvalidParameterValue.IllegalZone Invalid Zone parameter.
    InvalidParameterValue.InvalidParameterValueError Incorrect parameter value
    InvalidParameterValue.InvalidZoneIdError Invalid availability zone.
    InvalidParameterValue.SpecNotRecognizedError Failed to identify the specification ({{1}}).
    OperationDenied.CamDeniedError This operation cannot be performed.
    OperationDenied.InstanceStatusLimitError This operation cannot be performed on an instance in this status.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support