Anycast elastic IP addresses (EIPs) serve as fixed entry points for users across the globe to access resources on Alibaba Cloud. This topic provides a quick start guide on how to use Anycast EIPs to accelerate access to Alibaba Cloud and improve user experience.
Background information
A company has deployed applications on Alibaba Cloud in the Singapore (Singapore) region. The applications are hosted on Elastic Compute Service (ECS) instances that are connected to a Classic Load Balancer (CLB) instance in a virtual private cloud (VPC). An EIP is associated with the CLB instance. The ECS instances use the EIP to provide Internet-facing services. Users in the UK (London) and China (Hong Kong) regions use the EIP to access the ECS instances over the Internet. However, due to the high network latency of Internet connections, network jitters and packet loss frequently occur. To reduce network latency, the company wants to associate an Anycast EIP with the CLB instance. Then, users in the access point locations of the Anycast EIP can use the same public IP address to access the ECS instances through the nearest access point. This reduces the network latency and improves user experience. The following figure shows the network architecture.
Procedure

Step 1: Create an Anycast EIP
To use the Anycast EIP service, you must create an Anycast EIP. After you create an Anycast EIP, the system automatically allocates a public IP address to the Anycast EIP. You can use the public IP address to access services on Alibaba Cloud.
- Log on to the Anycast EIP console.
- On the Anycast Elastic IP Addresses page, click Purchase Anycast EIP.
- If this is the first time that you activate Anycast EIP, the billing of Internet data transfer and internal data transfer of Anycast EIPs is managed by Cloud Data Transfer (CDT). You must follow the instructions to activate CDT.
- Read and select Terms of Service and click Activate.
- In the message that appears, click Continue to Purchase.
Note If this is not the first time that you purchase Anycast EIPs, the pay-by-data-transfer metering method is used by default. For more information, see Billing. To use CDT to manage the billing of Anycast EIP, go to the Cloud Data Transfer page and select a region outside the Chinese mainland. Click Activate Now next to Anycast EIP. For more information, see What is CDT?. - On the buy page, set the following parameters and click Activate Now.
Parameter Description Region Select an access area for the Anycast EIP. Default value: Outside Chinese Mainland. Instance Spec Select a type. Default value: Standard. Billing method Select a billing method. Default value: Pay-By-Data-Transfer. For more information, see Billing. Name Enter a name for the Anycast EIP. Quantity Specify the number of Anycast EIPs that you want to purchase. After the purchase is complete, you can view the Anycast EIP in the instance list on the Anycast Elastic IP Addresses page.
Step 2: Associate the Anycast EIP with an endpoint
After you create an Anycast EIP, you must associate the Anycast EIP with an endpoint. Then, clients can use the Anycast EIP to access your services.
- Log on to the Anycast EIP console.
- On the Anycast Elastic IP Addresses page, find the Anycast EIP that you want to associate and click Manage in the Actions column.
- On the Bound Instances tab of the Anycast EIP details page, click Associate with Resource.
- In the Associate Anycast EIP with Resource dialog box, configure the following parameters and click OK.
Parameter Description Instance Type Select the type of endpoint with which you want to associate the Anycast EIP. Valid values: - CLB Instance (default)
- ENI.
Important- You can associate an Anycast EIP to only one endpoint in a region.
- Only CLB instances that are deployed in VPCs are supported.
- Before you associate an Anycast EIP with an ENI, make sure that the ENI is associated with an ECS instance but is not associated with a public IP address.
Resource Group Select the resource group to which the endpoint belongs. Set as Default Specify whether to set the endpoint as the default endpoint. Requests from access points that are not mapped to endpoints are routed to the default endpoint. - Yes: sets the endpoint as the default endpoint. This is the default value
- No: does not set the endpoint as the default endpoint.
Region Select the region where the endpoint is deployed. The following regions are supported: China (Hong Kong), Singapore, US (Silicon Valley), US (Virginia), or Germany (Frankfurt) region..
Areas Select access points. You can map access points to endpoints. You can select access points only if you set Set as Default to No.
Select an instance to associate Select the endpoint with which you want to associate the Anycast EIP.
Step 3: Verify network connectivity
After you complete the preceding steps, you can verify the connectivity between a client and a backend server.
- Open the CLI on a computer in your data center.
- Run the following command to test the network latency:
curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "The IP address that you want to access"
where:- time_connect: the connection time. The connection time refers to the amount of time that is consumed to establish a TCP connection. Unit: seconds.
- time_starttransfer: the start time of data transfer. The start time refers to the amount of time from when the client sends a request to the backend server to when the first byte is sent to the client. Unit: seconds.
- time_total: the total connection time. The total connection time refers to the amount of time from when the client sends a request to when the client receives the last byte from the backend server. Unit: seconds.
The result shows that when you use an Anycast EIP to access a backend server in the Singapore (Singapore) region, the network latency is reduced.