tencent cloud

文档反馈

CloneInstances

最后更新时间:2024-04-03 11:33:29

    1. API Description

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

    This API is used to clone a complete new instance based on the current instance backup file.

    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 Params. The value used for this API: CloneInstances.
    Version Yes String Common Params. The value used for this API: 2018-04-12.
    Region No String Common Params. This parameter is not required for this API.
    InstanceId Yes String The ID of the source instance to be cloned, such as "crs-xjhsdj****". Log in to the Redis console and copy the instance ID in the instance list.
    GoodsNum Yes Integer The number of clone instances at a time
    - The maximum number of monthly subscribed instances is 100 for each purchase.
    - The maximum number of pay-as-you-go instances is 30 for each purchase.
    ZoneId Yes Integer ID of the AZ where the clone instance resides. For more information, see Regions and AZs.
    BillingMode Yes Integer Billing mode. Valid values:
    • 0 (Pay-as-you-go)
    • 1 (Monthly subscription)
    Period Yes Integer Purchase duration of an instance.
    • Unit: Month
    • Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36, 48, 60 (for monthly subscription mode).
    • Valid value: 1 (for pay-as-you-go mode).
    SecurityGroupIdList.N Yes Array of String Security group ID, which can be obtained on the Security Group page in the console.
    BackupId Yes String Backup ID of the clone instance, which can be obtained through the DescribeInstanceBackups API.
    NoAuth No Boolean Whether the clone instance supports password-free access. Valid values:
    • true (Yes)
    • false (No. When SSL or public network is enabled). Default value: false.
    VpcId No String The VPC ID of the clone instance. If this parameter is not passed in, the classic network will be selected by default.
    SubnetId No String The VPC subnet ID to which the clone instance belongs, which is not required for the classic network.
    InstanceName No String Name of the clone instance.
    Enter up to 60 letters, digits, hyphens, and underscores.
    Password No String The access password of the clone instance.
    • When the input parameter NoAuth is true, this parameter is not required.
    • When the instance is Redis 2.8, 4.0, or 5.0, the password must contain 8–30 characters in at least two of the following types: lowercase letters, uppercase letters, digits, and special characters ()~!@#$%^&*-+=_|{}[]:;<>,.?/and cannot start with/`.
    • When the instance is CKV 3.2, the password must and can only contain 8–30 letters and digits.
    AutoRenew No Integer The auto-renewal flag. Valid values
    • 0: Manual renewal (default).
    • 1: Auto-renewal.
    • 2: Not auto-renewal (set by user).
    VPort No Integer Customized port. Valid range: 1024-65535. Default value: 6379.
    NodeSet.N No Array of RedisNodeInfo Node information of an instance.
    • Currently supported type and AZ information of a node to be configured (master node or replica node) For more information, see RedisNodeInfo.
    • This parameter is not required for single-AZ deployment.
    ProjectId No Integer Project ID. Log in to the Redis console, and find the project ID in Account Center > Project Management in the top-right corner.
    ResourceTags.N No Array of ResourceTag Tag to be bound for the clone instance
    TemplateId No String The parameter template ID associated with the clone instance
    - If this parameter is not configured, the system will automatically adapt the corresponding default template based on the selected compatible version and architecture.
    - You can query the parameter template list of the instance to get the template ID through the DescribeParamTemplates API.
    AlarmPolicyList.N No Array of String The alarm policy ID of the instance to be cloned. Log in to the Tencent Cloud Observable Platform console, and get the policy ID in Alarm Management > Policy Management.

    3. Output Parameters

    Parameter Name Type Description
    DealId String Request task ID
    InstanceIds Array of String Clone instance ID
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Sample request

    This example shows you how to clone an instance.

    Input Example

    POST / HTTP/1.1
    Host: redis.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CloneInstances
    <Common request parameters>
    
    {
        "InstanceId": "abc",
        "GoodsNum": 1,
        "NoAuth": true,
        "VpcId": "abc",
        "SubnetId": "abc",
        "ZoneId": 1,
        "InstanceName": "abc",
        "BillingMode": 0,
        "Period": 1,
        "Password": "abc",
        "AutoRenew": 1,
        "SecurityGroupIdList": [
            "abc"
        ],
        "VPort": 1,
        "BackupId": "abc",
        "NodeSet": [
            {
                "NodeId": 0,
                "NodeType": 0,
                "ZoneId": 1,
                "ZoneName": "abc"
            }
        ],
        "ProjectId": 0,
        "ResourceTags": [
            {
                "TagKey": "abc",
                "TagValue": "abc"
            }
        ],
        "TemplateId": "abc",
        "AlarmPolicyList": [
            "abc"
        ]
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "2a836c00-175f-11eb-aeb3-db134c8d8fec",
            "InstanceIds": [
                "crs-kic3****"
            ],
            "DealId": "22716"
        }
    }
    

    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.PayFailed Payment failed.
    FailedOperation.SystemError Internal system error, which is irrelevant to the business.
    FailedOperation.Unknown Invalid data is entered for weekday.
    InternalError.InternalError Internal error.
    InvalidParameter.EmptyParam The parameter is empty.
    InvalidParameter.OnlyVPCOnSpecZoneId Only VPCs are provided in the Shanghai Finance AZ.
    InvalidParameter.PermissionDenied The API has no CAM permissions.
    InvalidParameterValue.BaseNetWorkAccessDeny The instance is not in a VPC.
    InvalidParameterValue.CheckNotPass Business verification failed
    InvalidParameterValue.InvalidInstanceTypeId The type of instances requested for purchase is incorrect (TypeId - 1: Cluster Edition; 2: Master-Replica Edition, i.e., the legacy Master-Replica Edition).
    InvalidParameterValue.InvalidSubnetId The vpcid or subnet ID in the VPC is invalid.
    InvalidParameterValue.PasswordEmpty The password is empty.
    InvalidParameterValue.PasswordFreeDenied Tencent internal accounts are not allowed to use password-free instances.
    InvalidParameterValue.PasswordRuleError When the password is set, the old password passed in by MC does not match the previously set password.
    InvalidParameterValue.SecurityGroupIdsNotExists The request parameter or security group ID is incorrect.
    InvalidParameterValue.UnVpcIdNotExists The uniqVpcId or subnet ID in the VPC is invalid.
    LimitExceeded The quota limit has been reached.
    LimitExceeded.InvalidMemSize The requested capacity is out of the purchasable specification range (memSize should be an integer multiple of 1,024 in MB).
    LimitExceeded.InvalidParameterGoodsNumNotInRange The number of instances requested for purchase at a time is out of the purchasable quantity range.
    LimitExceeded.PeriodLessThanMinLimit The length of purchase is invalid. It must be at least one month.
    LimitExceeded.ReachTheAmountLimit The quantity of requested TencentDB for Redis instances falls out of the limit range.
    ResourceInsufficient The resource is insufficient.
    ResourceNotFound.AccountDoesNotExists The UIN value is empty.
    ResourceNotFound.InstanceNotExists No Redis instance is found by the serialId.
    ResourceUnavailable.InstanceDeleted The instance has already been repossessed.
    ResourceUnavailable.NoEnoughVipInVPC The IP resources in the VPC are insufficient.
    ResourceUnavailable.NoRedisService The requested region currently does not provide the Redis service.
    ResourceUnavailable.NoServiceAvailableForThisZoneId The requested zoneId doesn’t provide Redis service.
    ResourceUnavailable.SaleOut Resources of the specified type in the region are sold out.
    UnauthorizedOperation.NoCAMAuthed No CAM permissions.
    UnauthorizedOperation.UserNotInWhiteList The user is not in the allowlist.
    UnsupportedOperation The operation is not supported.