All Products
Search
Document Center

Elastic Compute Service:Change the public IP address of an ECS instance

Last Updated:Jan 24, 2024

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.

Note

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

Important

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.

    Note

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

    Note

    If 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

  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 system-assigned public IP address you want to change. In the Actions column, choose icon1 > Network and Security Group > Change Public IP Address.

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

Important

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

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

    Note

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

  2. Disassociate the EIP from the ECS instance. For more information, see Disassociate an EIP from a cloud resource.

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

  1. (Optional) Apply for a new EIP. For more information, see Apply for an EIP.

  2. Disassociate the current EIP from the ECS instance. For more information, see Disassociate an EIP from a cloud resource.

  3. 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: