Disassociates an elastic IP address (EIP) from a cloud resource.

Usage notes

  • UnassociateEipAddress is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. You can call the DescribeEipAddresses operation to query the status of an EIP:
    • If the EIP is in the Unassociating state, the EIP is being disassociated. In this state, you can only query the EIP and cannot perform other operations.
    • If the EIP is in the Available state, the EIP is disassociated.
  • You cannot repeatedly call the UnassociateEipAddress operation to disassociate an EIP within the specified period of time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes UnassociateEipAddress

The operation that you want to perform. Sett the value to UnassociateEipAddress.

Force Boolean No false

Specifies whether to disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway. Valid values:

  • false (default): does not disassociate the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway.
  • true: disassociates the EIP from a NAT gateway if a DNAT or SNAT entry is added to the NAT gateway.
RegionId String No cn-hangzhou

The ID of the region to which the EIP belongs.

You can call the DescribeRegions operation to query the most recent region list.

AllocationId String Yes eip-2zeerraiwb7uj6i0d****

The ID of the EIP that you want to disassociate.

InstanceId String No i-hp3akk9irtd69jad****

The ID of the instance from which you want to disassociate the EIP.

InstanceType String No EcsInstance

The type of instance from which you want to disassociate the EIP. Valid values:

  • EcsInstance (default): an Elastic Compute Service (ECS) instance in a virtual private cloud (VPC)
  • SlbInstance: a Server Load Balancer (SLB) instance in a VPC
  • NetworkInterface: a secondary elastic network interface (ENI) in a VPC
  • Nat: a NAT gateway
  • HaVip: a high-availability virtual IP address (HAVIP)
PrivateIpAddress String No 192.XX.XX.2

The private IP address of the ECS instance or the secondary ENI from which you want to disassociate the EIP.

ClientToken String No 02fb3da4-130e-11****

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not set this parameter, the system uses RequestId as ClientToken. RequestId might be different for each API request.

Response parameters

Parameter Type Example Description
RequestId String 0ED8D006-F706-4D23-88ED-E11ED28DCAC0

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UnassociateEipAddress
&Force=false
&RegionId=cn-hangzhou
&AllocationId=eip-2zeerraiwb7uj6i0d****
&InstanceId=i-hp3akk9irtd69jad****
&InstanceType=EcsInstance
&PrivateIpAddress=192.XX.XX.2
&ClientToken=02fb3da4-130e-11****	
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UnassociateEipAddressResponse>
    <RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
</UnassociateEipAddressResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}

Error codes

HttpCode Error code Error message Description
400 IncorrectEipStatus Current elastic IP status does not support this operation. The error message returned because you cannot perform the operation when the specified EIP is in the current state.
400 InvalidInstanceId.NotFound Specified instance does not exist. The error message returned because the specified instance does not exist. Check whether the specified instance is valid.
400 IncorrectInstanceStatus The current status of instance does not support this operation. The error message returned because this operation cannot be performed when the instance is in the current state.
400 InvalidInstanceType.ValueNotSupported The specified value of InstanceType is not supported. The error message returned because InstanceType is set to an invalid value.
400 IncorrectHaVipStatus This operation is denied because satus of the specified HaVip is neither Available nor InUse. The error message returned because you cannot perform the operation when the specified HAVIP is in the Available or InUse state.
400 OperationDenied Eip of default vpc not allow this operation The error message returned because the operation is not supported by EIPs in the default VPC.
400 InvalidParameter The specified parameter is not valid. The error message returned because the parameter is set to an invalid value.
400 TaskConflict The eip operate too frequent, TaskConflict. The error message returned because the operations are too frequent and tasks conflict with each other.
400 InvalidBindingStatus The eip binding status invalid. The error message returned because the EIP is in an invalid state.
400 Forbidden.FinancialLocked The ip business status is invalid. The error message returned because the instance has overdue payments.
400 Eni.Attached The eni should be detached from ecs when associating with direct eip. The error message returned because the ENI is associated with an EIP in cut-through mode. You must disassociate the ENI from the ECS instance.
400 InvalidEIPStatus.BizDisabled The EIP has been locked. The error message returned because the EIP is locked.
400 InvalidStatus.EcsStatusNotSupport The special instance status Pending is not support operate The error message returned because the instance is suspended and the operation is not supported.
400 InvalidStatus.SnatOrDnat Operation failed because snat or dnat in unstable status. The error message returned because the SNAT or DNAT entry is in an unstable state and the EIP failed to be disassociated.
400 InvalidStatus.NotAllow Bind instance status invalid The error message returned because the status of the associated instance is invalid.
400 Forbidden The eip instance owener error The error message returned because the EIP does not belong to you. Check whether you are authorized to perform the operation on the EIP.
400 InvalidLoadBalancerId.NotFound LoadBalancerId does not exist. The error message returned because the ID of the SLB instance does not exist.
404 InvalidAllocationId.NotFound Specified allocation ID is not found The error message returned because the specified EIP does not exist. Check whether the specified value is valid.
404 Forbidden.RegionNotFound Specified region is not found during access authentication. The error message returned because the specified region does not exist. Check whether the specified region ID is valid.

For a list of error codes, see Service error codes.