The system reclaims a static public IP address when you change the bandwidth to 0 Mbps, stop a pay-as-you-go instance in economical mode, or release the instance. Therefore, this IP address type is not suitable for production environments that require a long-term, persistent IP address.
Assign a static public IP
Assign a public IP when you create an instance
ECS Console
Quick launch:
On the ECS console - Quick Launch page, in the Public Bandwidth section, select Assign Public IPv4 Address.
Set the bandwidth billing method:
Pay-by-bandwidth: You are charged based on the amount of bandwidth provisioned over time. This method is suitable for scenarios with stable service traffic.
Pay-by-traffic: You are charged based on the volume of outbound data transfer. This method is suitable for scenarios with fluctuating service traffic.
Custom launch:
On the ECS console - Custom Launch page, in the Public IP Address section, select Assign Public IPv4 Address.
Set the Bandwidth Billing Method:
Pay-by-bandwidth/Bandwidth: You are charged based on the amount of bandwidth provisioned over time. This method is suitable for scenarios with stable service traffic.
Pay-by-traffic/Maximum Bandwidth: You are charged based on the volume of outbound data transfer. This method is suitable for scenarios with fluctuating service traffic.
API
When calling the RunInstances operation to create an instance, set the InternetMaxBandwidthOut
parameter to a value greater than 0 Mbps.
Assign a public IP to an existing instance
ECS Console
Go to ECS console - Instances and click the target instance ID to open its details page.
From the All Actions section, select Change Pay-as-you-go Instance Bandwidth or Change Subscription Instance Bandwidth.
Specify the Bandwidth Billing Method:
Pay-by-traffic: You are charged based on the volume of outbound data transfer. This method is suitable for scenarios with fluctuating service traffic.
Pay-by-bandwidth: You are charged based on the amount of bandwidth provisioned over time. This method is suitable for scenarios with stable service traffic.
Set Bandwidth (or Maximum Bandwidth) to a value greater than 0 Mbps. The system then assigns a static public IP address to the instance.
API
Call the ModifyInstanceSpec operation and set the InternetMaxBandwidthOut
parameter to a value greater than 0 Mbps.
Change a static public IP address
If the static public IP address is configured in your applications, whitelists for cloud services (such as databases or cache services), or system configuration files (such as /etc/hosts), you must update all related configurations after changing the IP address to avoid service disruptions.
Within 6 hours after the instance creation
If you have changed the public IP address for the instance more than three times within 6 hours after the instance creation, you must use the method described in More than 6 hours after the instance creation.
Go to ECS console - Instances and click the target instance ID to open its details page.
In the All Actions section, choose
. In the dialog box, select Standard Mode as the stop mode.If you select economical mode, the public IP address is reclaimed, and you cannot perform the change operation.
In the All Actions section, choose
.When the change is complete, a dialog box displays the new static public IP address.
More than 6 hours after the instance creation
A static public IP address is bound to its instance. To change the IP address, you can convert it into an Elastic IP Address (EIP) to unbind it from the instance and then get a new static public IP.
You cannot perform this operation within 24 hours before a subscription instance expires.
For an instance with the pay-by-bandwidth billing method, you must first change the billing method to pay-by-traffic before you perform this operation.
Set the maximum public bandwidth for the instance to a value greater than 0 Mbps. The system automatically assigns a new static public IP address to the instance.
Release the EIP to stop incurring EIP configuration fees (public IP holding fees).
Release and reclaim a static public IP address
The system automatically reclaims a static public IP address, which cannot be recovered, in the following situations:
Change bandwidth to 0: The system reclaims the public IP address when the public bandwidth of the instance is set to 0 Mbps.
Stop the instance in economical mode: For a pay-as-you-go instance, the system reclaims the public IP address if you select economical mode when you stop the instance.
Release the instance: When an ECS instance is released, the system also reclaims its bound public IP address.
Billing
When you use a static public IP address, you are not charged for holding the IP address itself. You are only charged for outbound public bandwidth. For detailed billing rules, see Bandwidth billing.
FAQ
Can I resolve high latency when accessing an ECS instance in an overseas region from the Chinese mainland by changing its public IP address?
No. When you access an ECS instance in an overseas region from the Chinese mainland, traffic passes through international carrier routes. This can lead to network instability due to international link congestion and outbound routing limitations. Use an instance located in the Chinese mainland or use Global Accelerator.
Can I specify a particular IP address when assigning or changing a static public IP address?
No. The system randomly assigns an available IP address. You cannot choose a specific one.
Reference
Use an Elastic IP Address for production workloads or services that require a persistent and easily manageable IP address.