tencent cloud

文档反馈

AssociateAddress

最后更新时间:2023-08-18 14:28:16

1. API Description

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

This API is used to bind an EIP to an instance or the specified private IP of an ENI.
Binding an EIP to an instance (ECM) is essentially to bind it to the primary private IP of the primary ENI of the instance.
When you bind an EIP to the private IP of the specified ENI, if the private IP is already bound to an EIP or public IP, a failure will be reported, and you must unbind it first before you can bind it to a new EIP.
Only EIPs in UNBIND status can be bound to a private IP.

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: AssociateAddress.
Version Yes String Common Params. The value used for this API: 2019-07-19.
Region No String Common Params. This parameter is not required for this API.
EcmRegion Yes String ECM region
AddressId Yes String Unique EIP ID, such as eip-11112222.
InstanceId No String ID of the instance to be bound.
NetworkInterfaceId No String ID of the ENI to be bound, such as eni-11112222. NetworkInterfaceId and InstanceId cannot be specified at the same time. The ENI ID can be obtained from the networkInterfaceId field in the returned value of the DescribeNetworkInterfaces API.
PrivateIpAddress No String Private IP to be bound. If you specify NetworkInterfaceId, you must also specify PrivateIpAddress, which means to bind the EIP to the specified private IP of the specified ENI. You must also make sure that the specified PrivateIpAddress is a private IP of the specified NetworkInterfaceId. The private IP of the specified ENI can be obtained from the privateIpAddress field in the returned value of the DescribeNetworkInterfaces API.

3. Output Parameters

Parameter Name Type Description
TaskId String Async task ID (TaskId). You can use the DescribeTaskResult API to query the task status.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Binding EIP to instance

This example shows you how to bind an EIP to the primary ENI of an instance with no public IPs.

Input Example

https://ecm.tencentcloudapi.com/?Action=AssociateAddress
&AddressId=eip-11112222
&InstanceId=ins-11221122
&EcmRegion=ap-hangzhou-ecm
&<Common request parameters>

Output Example

{
    "Response": {
        "TaskId": "123",
        "RequestId": "3c140219-cfe9-470e-b241-907877d6fb03"
    }
}

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.InternalOperationFailure Internal error.
FailedOperation.InvalidStatus This operation cannot be performed in the current status.
FailedOperation.OperationNotAllow The current operation is not allowed.
FailedOperation.PrivateIpAddressUnavailable The private IP is unavailable.
InvalidParameter The parameter is incorrect.
InvalidParameter.Coexist The parameters cannot be specified at the same time.
InvalidParameter.InvalidDataFormat The data format is incorrect.
InvalidParameter.InvalidParameterConflict The two specified parameters conflict. An EIP can only be bound to an instance or the specified private IP of the specified ENI.
InvalidParameterValue The parameter value is incorrect.
InvalidParameterValue.InvaildEniID The ENI ID is invalid.
InvalidParameterValue.InvalidInstanceID The instance ID is invalid.
InvalidParameterValue.InvalidPublicParam The common parameter is invalid.
InvalidParameterValue.InvalidRegion The ECM region is invalid.
LimitExceeded.AddressQuotaLimitExceeded The number applied for exceeds the limit.
MissingParameter The parameter is missing.
MissingParameter.MissingAssociateEntity The entity parameter to be associated is missing.
ResourceInUse The resource is in use.
ResourceNotFound The resource does not exist.
UnauthorizedOperation.ForbiddenOperation You don't have the permission to perform this operation.
UnsupportedOperation Unsupported operation.
UnsupportedOperation.AddressIdNotFound The IP was not found.
UnsupportedOperation.AlreadyBindEip The specified instance has been bound to an EIP. You must unbind it from the current EIP first before you can bind it to another EIP.
UnsupportedOperation.InstanceIdNotFound The instance ID is invalid, as the specified instance ID does not exist.
UnsupportedOperation.InstanceIdNotSupported The instance is not supported.
UnsupportedOperation.InvalidNetworkInterfaceIdNotFound The specified NetworkInterfaceId does not exist, or the specified PrivateIpAddress is not on the NetworkInterfaceId.
UnsupportedOperation.InvalidPrivateIpAddressAlreadyBindEip The specified private IP of the specified ENI has already been bound to an EIP. A private IP cannot be bound to more than one EIP.
UnsupportedOperation.Malformed Please check whether the provided IP address is complete.
UnsupportedOperation.StatusNotPermit This operation cannot be performed in the current status.