Bind CVM with VIP

Last updated: 2018-08-23 17:39:10

1. API Description

This API (AssociateVip) is used to bind a pre-assigned private VIP to the specified CVM, so as to enable master and backup switchover.

The feature of this API can be implemented by using ENIs. It's recommended NOT to use this API.

You can use a new API to establish a master/slave cluster in VPC using keepalived. For more information, see here.

Domain for API request: vpc.api.qcloud.com

1) You need to contact Tencent Cloud customer service to apply for the VIP.
2) The CVM must be in the VPC.

2. Input Parameters

The following request parameter list only provides API request parameters. Common request parameters need to be added when the API is called. For more information, see Common Request Parameters. The Action field for this API is AssociateVip.

Parameter Name Required Type Description
vpcId Yes String The Virtual Private Cloud ID assigned by the system. Both the vpcId before upgrading and the upgraded unVpcId are supported. For example: vpc-2ari9m7h.
vipId Yes Int VIP ID, for example: 12. You need to contact the online customer service to apply for a VIP ID
lanIp Yes String CVM private IP, for example: 10.0.0.1. To query the CVM IP, please see Query Instance List

3. Output Parameters

Parameter Name Type Description
code Int Common error code; 0: Succeeded; other values: Failed. For more information, please see Common Error Codes on the Error Code page.
message String Module error message description depending on API.

4. Error Codes

The following error code list only provides the error codes for this API. For common error codes, please see VPC Error Codes.

Error Code Description
InvalidVipId.NotFound The vipId does not exist. Currently, VIP needs to be assigned manually. If you forgot your vipId or this is your first time binding, please contact the customer service to retrieve your vipID or apply for a vipID.
InvalidLanIp.NotFound The CVM does not exist. Please check the information you entered.To query the CVMs under the VPC, please see Query CVM Instance List.
InvalidVpc.NotFound The VPC does not exist. Please check the information you entered.

5. Example

Input


  https://vpc.api.qcloud.com/v2/index.php?Action=AssociateVip
    &<Common request parameters>
  &vpcId=vpc-2ari9m7h
    &vipId=1
    &lanIp=10.0.0.2

Output


{
    "code": 0,
    "message": ""
}