This topic provides a solution for the 'The IP is already in use' error message encountered when attaching an Elastic IP Address (EIP) to an ECS instance via an API.
Possible causes
The error may occur if the instance has been repeatedly attached to a public IP address. Check if the ECS instance in question is already bound to a public IP address. If it is, you can proceed to detach the public IP address based on the given IP address.
Solution
If you no longer need to access an ECS instance over the Internet or you need to change an EIP of the instance, we recommend that you disassociate the EIP from the instance to avoid resource waste.
You are not able to access the ECS instance over the Internet after you disassociate an EIP from the instance. Before you disassociate an EIP, make sure that Internet access is no longer required or you can access the instance over alternative network connections.
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
Find the ECS instance from which you want to disassociate an EIP and choose in the Action column.
In the Disassociate EIP message, confirm the message and select "I am aware of the costs and risks".
Click Confirm.
After the EIP is disassociated from the instance, the EIP is not displayed in the IP Address column corresponding to the instance on the Instances page.
(Optional) After an EIP is disassociated from an ECS instance, you are still charged for the EIP. If you no longer use the EIP, you can release the EIP. For more information, see Release a pay-as-you-go EIP.