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. Network architecture

Procedure

Process

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.

  1. Log on to the Anycast EIP console.
  2. On the Anycast Elastic IP Addresses page, click Purchase Anycast EIP.
  3. 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.
    1. Read and select Terms of Service and click Activate.
    2. 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?.
  4. On the buy page, set the following parameters and click Activate Now.
    ParameterDescription
    RegionSelect an access area for the Anycast EIP. Default value: Outside Mainland China.
    Instance SpecSelect a type. Default value: Standard.
    Billing MethodSelect a billing method. Default value: Pay-By-Data-Transfer. For more information, see Billing.
    NameEnter a name for the Anycast EIP.
    QuantitySpecify the number of Anycast EIPs that you want to purchase.
    Terms of ServiceRead and select Anycast EIPs Terms of Service.

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.

  1. Log on to the Anycast EIP console.
  2. On the Anycast Elastic IP Addresses page, find the Anycast EIP that you want to associate and click Manage in the Actions column.
  3. On the Bound Instances tab of the Anycast EIP details page, click Associate with Resource.
  4. In the Associate Anycast EIP with Resource dialog box, configure the following parameters and click OK.
    ParameterDescription
    Instance TypeSelect 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 GroupSelect the resource group to which the endpoint belongs.
    Set as DefaultSpecify 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.
    RegionSelect 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..

    AreasSelect 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 associateSelect 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.

Note The network conditions depend on the network of your ISP. In this example, the network latency is tested to evaluate the network condition between the client and a backend server of the CLB instance.
  1. Open the CLI on a computer in your data center.
  2. 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. Network latency when an Anycast EIP is used