Assign a static public IP address to an Elastic Compute Service (ECS) instance to enable the ECS instance to communicate over the Internet. This topic describes the procedures for assigning, changing, releasing, and revoking a static public IP address for an ECS instance.
Assign a static public IP address
When you purchase an ECS instance, refer to the figure below to configure the public bandwidth for the ECS instance. You must select Assign Public IPv4 Address, set Bandwidth Billing Method, and specify Bandwidth or Maximum Bandwidth. Alibaba Cloud then assigns a public IPv4 address from its address pool to your ECS instance. For more information about purchasing an ECS instance, see Create an instance on the Custom Launch tab and Create a subscription instance on the Quick Launch tab.
For existing instances without a public IP address, you can increase the maximum bandwidth above 0 Mbit/s to trigger the system to automatically generate a static public IPv4 address for your ECS instance. For detailed information, see Modify the public bandwidth configurations of an instance associated with an auto-assigned public IP address and Modify the bandwidth configurations of pay-as-you-go instances.
Pay for a static public IP address
Accessing the Internet using a static public IP address, you are not charged for resource retention fees but charged for outbound bandwidth fees over the Internet.
The billing methods of a static public IP address include Pay-by-bandwidth and Pay-by-traffic. For detailed billing information, see Public bandwidth.
Change the static public IP address
Within six hours after an instance is created
You can use the Change Public IP button in the console.
Prerequisites
You ECS instance is in the
Stopped
state.NoteIf you use a pay-as-you-go, internal-facing ECS instance, you must stop your ECS instance in standard mode. If you stop the ECS instance in Economical mode, the static public IP address of the ECS instance cannot be changed. For more information, see Economical mode.
The number of IP address changes for an ECS instance cannot exceed three.
NoteIf you need to change the public IP address of your ECS instance more than three times, see More than six hours after an instance is created.
Sample 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 for which you want to change the public IP address. In the Actions column, choose
.In the Change Public IP Address dialog box, check the information and click Confirm.
Upon a successful change, the dialog box displays the new static public IP address assigned to your ECS instance.
More than six hours after an instance is created
If more than six hours have passed since an ECS instance is created, the static public IP address cannot be directly changed. Instead, you must reassign a static public IP address to your ECS instance using the following method:
Convert the static public IP address of your ECS instance (excluding pay-by-bandwidth subscription instances) to an EIP, which keeps the IP address unchanged.
For more information, see Convert the public IP address of an ECS instance in a VPC to an EIP.
ImportantA subscription ECS instance does not support this operation within 24 hours before an expiration.
For pay-by-bandwidth subscription ECS instances, change the billing method to Pay-by-traffic as described in Change from pay-by-bandwidth to pay-by-traffic, then proceed with the conversion.
Disassociate the EIP from the ECS instance.
For more information, see Disassociate an EIP from a cloud resource.
ImportantAfter disassociating a pay-as-you-go EIP, you are still charged for EIP configuration fees until you release the EIP.
For information about EIP configuration fees, see Pay-as-you-go.
To release a pay-as-you-go EIP, see Release a pay-as-you-go EIP.
After disassociating a subscription EIP, if you no longer need it, you can unsubscribe from the EIP instance. For more information, see Rules for unsubscribing from resources.
Increase the maximum bandwidth above 0 Mbit/s to trigger the system to automatically assign a new public IPv4 address to the ECS instance.
For more information, see Modify the public bandwidth configurations of an instance associated with an auto-assigned public IP address and Modify the bandwidth configurations of pay-as-you-go instances.
After the above steps, check the new public IP address by refering to Overview.
Release and revoke a static public IP address
Upon the release of an ECS instance, the static public IP address of the ECS instance is revoked and cannot be retained. In addition, the static public IP address of an ECS instance may also be revoked or reassigned in the following scenarios:
The static public IP address is revoked if you set the bandwidth of your ECS instance to 0 Mbit/s when your ECS instance is in use. For more information, see Modify the public bandwidth configurations of an instance associated with an auto-assigned public IP address and Modify the bandwidth configurations of pay-as-you-go instances.
The static public IP address is released if you stop your pay-as-you-go ECS instance in Economical mode. When you start the ECS instance again, a new static public IP address is automatically assigned to it, which is rarely the same static public IP address that is assigned to your ECS instance before.
If you want more than one ECS instances to use the same public IP address, or retain a public IPv4 address of an ECS instance after the ECS instance is released, we recommend that you use an Elastic IP address (EIP). An EIP enables more flexible operations than a static public IP address, supporting association or disassociation with ECS instances. For more information, see Convert the public IP address of an ECS instance in a VPC to an EIP.
FAQs
If I encounter high network latency when I access an ECS instance deployed in a region outside Chinese mainland from a place within Chinese mainland, can I resolve the issue by changing the static public IP address?
No, the issue can hardly be resolved.
When you access an ECS instance deployed in a region outside Chinese mainland from a place within Chinese Mainland, requests travel through international-facing routing nodes provided by your Internet service provider (ISP), suffer from international data link congestion, and are restricted by regulations on international-facing ICP routing mechanisms. Therefore, you may inevitably experience unstable network links, high packet loss, and other network issues, even unreachable ECS instances from clients within certain places.
If most users of your service or application are within Chinese mainland, we recommend that you deploy your ECS instance in a region also within Chinese mainland, avoiding disadvantages brought by international Internet travel.
If you want to enable your users within Chinese mainlan to access an ECS instance deployed in a region outside Chinese mainland, we recommend that you leverage Global Accelerator. For more information, see What is Global Accelerator?
Can I specify an IP address to assign it to my ECS instance or change the current static public IP address to it?
No, the IP address cannot be specified.
The static public IP address can only be assigned by the system. Specifying an IP address is not supported.