All Products
Search
Document Center

Elastic Compute Service:Convert the public IP address of an instance in a VPC to an EIP

Last Updated:Mar 22, 2023

The auto-assigned public IP address of an Elastic Compute Service (ECS) instance that resides in a virtual private cloud (VPC) cannot be disassociated from the instance. If you want to associate or disassociate the auto-assigned public IP address to or from instances as needed and flexibly manage the IP address, you can convert the auto-assigned public IP address to an elastic IP address (EIP). This address conversion does not affect access from the Internet to the instance or cause transient network interruptions.

Background information

Differences between auto-assigned public IP addresses in VPCs and EIPs

Auto-assigned public IP addresses in VPCs and EIPs enable ECS instances to communicate with the Internet. Auto-assigned public IP addresses in VPCs and EIPs are different in the following ways:

  • Auto-assigned public IP addresses in VPCs

    When ECS instances are created in VPCs, public IP addresses can be automatically assigned to the instances. The auto-assigned public IP addresses cannot be disassociated from the instances.

  • EIP

    EIPs are static public IP addresses that can be purchased and used as independent resources. You can associate and disassociate EIPs to and from ECS instances as needed.

For more information, see Elastic IP addresses.

Impacts of the conversion of an auto-assigned public IP address in a VPC to an EIP

Item

Impact

Address convertibility

After the auto-assigned public IP address of an instance that resides in a VPC is converted to an EIP, you cannot convert the EIP back to the auto-assigned public IP address.

IP address

The auto-assigned public IP address is converted to and retained as an EIP.

Billing method for network usage

The pay-by-traffic billing method for network usage remains unchanged.

Billable item

The EIP is separately billed, and separate bills are generated. For more information about EIP billing, see Billing overview. You can go to the Billing Management console, choose Spending Summary > Spending Summary in the left-side navigation pane, and then click the Details tab. Then, you can filter by Instance Name or Instance ID to find and export the consumption details about a specific EIP.

Prerequisites

Before you convert the auto-assigned public IP address of an instance in a VPC to an EIP, make sure that the following requirements are met:

  • The instance has an auto-assigned public IP address.

  • If the instance is a pay-as-you-go instance, you have no overdue payments in your account.

  • If the instance is a subscription instance, the instance has at least 24 hours remaining in its subscription duration and uses the pay-by-traffic billing method for network usage. If the subscription instance uses the pay-by-bandwidth billing method for network usage, change the billing method for network usage to pay-by-traffic. For more information, see Overview of instance configuration changes.

  • If an instance type change is made for the instance, wait until the new instance type takes effect before you convert the auto-assigned public IP address.

  • The instance is in the Running or Stopped state.

Procedure

Note

You can also call the ConvertNatPublicIpToEip operation to convert the auto-assigned public IP address of an instance in a VPC to an EIP. To call this operation, use SDKs 4.3.0 or later. For more information, see SDK overview.

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the top navigation bar, select a region.
  4. Find an instance whose network type is VPC. In the Actions column, choose More > Network and Security > Convert to EIP.

  5. In the dialog box that appears, confirm the information and click OK.

  6. Refresh the instance list.

Verify the result

After the auto-assigned public IP address is converted to an EIP, the IP address is marked (Elastic).

You can click the EIP to go to the Elastic IP Addresses page in the VPC console to manage the EIP.

What to do next

After the auto-assigned public IP address is converted to an EIP, you can perform the following operations: