All Products
Search
Document Center

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

Last Updated:Nov 12, 2024

As your business grows, you may deploy more Elastic Compute Service (ECS) instances on top of an existing one to provide services to your customers. To ensure that the same IP address is used by your service, you can convert the public IP address that is assigned to your existing ECS instance to an Elastic IP Address (EIP) and bind the EIP to a Server Load Balancer (SLB) instance or other ECS instances. This allows you to scale out your business without affecting ongoing services. This topic describes how to convert an auto-assigned public IP address to an EIP.

Differences between auto-assigned public IP addresses and EIPs

IP addresses provide access to your services over the Internet, regardless of whether the IP addresses are auto-assigned public IP addresses or EIPs. Auto-assigned public IP addresses and EIPs are different in the following ways:

  • Auto-assigned public IP addresses

    When ECS instances are created in VPCs, public IP addresses can be automatically assigned to the instances. For an instance that is created without a public IP address, you can change the configuration to increase the peak bandwidth to greater than 0 Mbit/s, which will automatically generate a public IP address for the instance. For more information, see Overview.

  • 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.

Precautions

Item

Description

Address convertibility

After an auto-assigned public IP address is converted to an EIP, you cannot convert the EIP back to the auto-assigned public IP address.

If you require an auto-assigned public IP address for your instance after the conversion, you can unbind the EIP from the instance and adjust the public bandwidth for a new public IP address to be assigned to your instance. For more information, see Modify the bandwidth configurations of subscription instances or Modify the bandwidth configurations of pay-as-you-go instances.

Note

Alternatively, you can call the ModifyInstanceNetworkSpec operation to modify the public bandwidth of your ECS instance and enable a new public IP address to be assigned to the instance.

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 the billing of EIPs, see Billing overview.

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 is created in a VPC and 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.

  • BGP (Multi-ISP) Pro in the China (Hong Kong) region does not support the pay-by-traffic billing method.

  • 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 Install and use ECS SDKs.

  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 the region and resource group to which the resource belongs. 地域

  4. Find the ECS instance whose network type is VPC and whose IP address you want to convert. In the Actions column, choose icon1 > Network and Security > Convert to EIP.

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

  6. Refresh the instance list.

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

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

    image.png

What to do next

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