If a public IP address is associated with an Elastic Compute Service (ECS) instance that is deployed in the classic network or a virtual private cloud (VPC), you can change the public IP address based on your business requirements in various scenarios, such as scenarios in which network security needs to be increased, the IP address is blocked, and resources are migrated. This topic describes how to change the public IP address of an ECS instance.
Background information
Public IP addresses include system-assigned public IP addresses and elastic IP addresses (EIPs). System-assigned public IP addresses are also called auto-assigned public IP addresses. Both system-assigned public IP addresses and EIPs can provide access to your services over the Internet.
System-assigned public IP addresses
When ECS instances are created in VPCs, public IP addresses can be automatically assigned by the system to the instances. You cannot disassociate the system-assigned public IP addresses from the ECS instances.
EIPs
EIPs are static public IP addresses that you can purchase and use as independent resources. You can associate EIPs with and disassociate EIPs from ECS instances based on your business requirements. For more information, see What is an EIP?
The operations that you must perform to change the public IP address of an ECS instance vary based on the type of the public IP address that is associated with the instance.
The operations that are described in this topic do not apply to an ECS instance to which a public IP address is not assigned by the system when the instance is created. You can change the public bandwidth of the ECS instance to allow the system to assign a public IP address to the instance. For more information, see Modify public bandwidth configurations or Modify the bandwidth configurations of pay-as-you-go instances.
Public IP address type | Period of time that elapsed after an ECS instance is created | Limits | Procedure |
System-assigned public IP address | Within 6 hours | You can change the system-assigned public IP address of the instance up to three times if the following requirements are met:
| See the Within 6 hours after an ECS instance is created section of this topic. |
More than 6 hours | You cannot directly change the system-assigned public IP address of the ECS instance. If you deploy the instance in a VPC, you can perform the following operations to allow the system to assign a new public IP address to the instance: Convert the current system-assigned public IP address of the instance into an EIP, disassociate the EIP from the instance, and then change the public bandwidth of the instance to a value greater than 1 Mbit/s. | See the More than 6 hours after an ECS instance is created section of this topic. | |
EIP | Regardless of the period of time that elapsed after an ECS instance is created |
| See the Change the EIP of an ECS instance section of this topic. |
Change the system-assigned public IP address of an ECS instance
Within 6 hours after an ECS instance is created
You can change the system-assigned public IP address of an ECS instance up to three times within 6 hours after the instance is created.
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 whose system-assigned public IP address you want to change. In the Actions column, choose
.In the Change Public IP Address message, confirm the information and click Confirm.
When the public IP address of the instance is changed, a new public IP address is displayed in the preceding message.
More than 6 hours after an ECS instance is created
(Optional) If the ECS instance is a pay-as-you-go instance that 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 the Change from pay-by-bandwidth to pay-by-traffic section of the "Change the billing method for network usage" topic.
Convert the system-assigned public IP address of the ECS instance into an EIP.
For more information, see Convert the public IP address of an ECS instance in a VPC to an EIP.
Disassociate the EIP from the ECS instance.
For more information, see Disassociate an EIP from a cloud resource.
ImportantAfter you disassociate a pay-as-you-go EIP from a cloud resource, you are still charged an EIP configuration fee. To avoid unnecessary fees, release the EIP.
For information about EIP configuration fees, see Pay-as-you-go.
For information about how to release a pay-as-you-go EIP, see Release a pay-as-you-go EIP.
If you no longer need a subscription EIP after you disassociate the EIP from a cloud resource, you can unsubscribe from the EIP. For more information, see Rules for unsubscribing from resources.
Change the public bandwidth of the ECS instance to a value greater than 1 Mbit/s to allow the system to assign a new public IP address to the instance.
For more information, see Modify public bandwidth configurations or Modify the bandwidth configurations of pay-as-you-go instances.
Change the EIP of an ECS instance
If your ECS instance uses an EIP instead of a system-assigned public IP address, perform the following operations to change the EIP of the instance:
(Optional) Apply for a new EIP.
For more information, see Apply for an EIP.
Disassociate the current EIP from the ECS instance.
For more information, see Disassociate an EIP from a cloud resource.
ImportantAfter you disassociate a pay-as-you-go EIP from a cloud resource, you are still charged an EIP configuration fee. To avoid unnecessary fees, release the EIP.
For information about EIP configuration fees, see Pay-as-you-go.
For information about how to release a pay-as-you-go EIP, see Release a pay-as-you-go EIP.
If you no longer need a subscription EIP after you disassociate the EIP from a cloud resource, you can unsubscribe from the EIP. For more information, see Rules for unsubscribing from resources.
Associate the new EIP with the ECS instance.
For more information, see Associate an EIP with an ECS instance.
References
After you change the public IP address of an ECS instance, you may need to perform the following operations:
Reconfigure the security group rules that are associated with the ECS instance. For more information, see Modify a security group rule.
Monitor the network bandwidth or simulate real user access to monitor access to your website. For more information, see What is CloudMonitor? and Network Analysis and Monitoring.
Update network permissions for Cloud Assistant or modify the Domain Name System (DNS) settings of Cloud Assistant. For more information, see Configure network permissions for Cloud Assistant Agent and Configure DNS settings for Cloud Assistant.
FAQ
Can I change the public IP address of an ECS instance in a region outside the Chinese mainland to resolve the high latency issue that occurs when I access the instance from the Chinese mainland?
No, you cannot change the public IP address of the ECS instance to resolve the high latency issue.
Cross-border communication between regions in the Chinese mainland and regions outside the Chinese mainland may be affected by connection congestion and the regulations of Internet service providers (ISPs), which may lead to network link instability and cause packet loss or other exceptions. As a result, you cannot access ECS instances in specific regions outside the Chinese mainland from specific regions in the Chinese mainland.
If you provide services for users in the Chinese mainland, we recommend that you deploy ECS instances in a region inside the Chinese mainland to bypass the limitations of cross-border communication.
If you want users in the Chinese mainland to access ECS instances in a region outside the Chinese mainland in a stable manner, we recommend that you use Global Accelerator (GA). For more information, see What is GA?
After I convert a system-assigned public IP address into an EIP, can I convert the EIP into a system-assigned public IP address?
No,
you cannot convert the EIP into a system-assigned public IP address. After you convert a system-assigned public IP address into an EIP, you are charged for the EIP based on the billing method of the EIP. For more information, see Billing overview.
Can I specify an IP address as the public IP address when I change the public IP address of an ECS instance?
No, you cannot specify an IP address as the public IP address when you change the public IP address of an ECS instance.
When you change the system-assigned public IP address or EIP of an ECS instance, the system randomly assigns an IP address to the instance.