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 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.
The public IP address of an ECS instance can be an elastic IP address (EIP) or a system-assigned public IP address, which is also called an auto-assigned public IP address.
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 3 times within 6 hours after the instance is created.
Prerequisites
The ECS instance whose system-assigned public IP address you want to change meets the following requirements:
Less than 6 hours elapsed after the instance is created.
A public IP address is assigned by the system to the instance.
NoteThe operations that are described in this topic are not applicable to an ECS instance to which a public IP address is not assigned by the system during instance creation. You can adjust the public bandwidth for the ECS instance to allow the system to assign a public IP address to the instance. For more information, see Modify the bandwidth configurations of subscription instances or Modify the bandwidth configurations of pay-as-you-go instances.
The instance is in the Stopped (
Stopped
) state.NoteIf the billing method of an instance is pay-as-you-go and the network type of the instance is VPC, you must enable the standard mode for the instance when you stop the instance. If you enable the economical mode for the instance, the Change Public IP Address option is not displayed in the ECS console.
Procedure
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
You cannot directly change the system-assigned public IP address of an ECS instance more than 6 hours after the instance is created. If you deploy the instance in a VPC and the instance is not a subscription instance that uses the pay-by-bandwidth metering method for network usage, you can perform the following operations to change the system-assigned public IP address of the instance.
Procedure
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 instance in a VPC to an EIP.
NoteIf the ECS instance no longer requires a system-assigned public IP address, you can convert the system-assigned public IP address into an EIP and then change the EIP. For more information, see the Change the EIP of an ECS instance section in this topic.
Disassociate the EIP from the ECS instance. For more information, see Disassociate an EIP from a cloud resource.
Adjust the public bandwidth of the ECS instance to allow the system to assign a new public IP address to the instance. For more information, see Modify the bandwidth configurations of subscription instances or Modify the bandwidth configurations of pay-as-you-go instances.
Change the EIP of an ECS instance
If you associate an EIP with an ECS instance, you can perform the following operations to change the EIP.
(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.
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.