All Products
Search
Document Center

Server Load Balancer:Quick start: Load balance IPv4 services with CLB

Last Updated:Aug 23, 2026

Use Classic Load Balancer (CLB) to distribute traffic across multiple backend servers, eliminating single points of failure and building a highly available application architecture.

Overview

Set up CLB load balancing for IPv4 services in three steps:

  1. Create an internet-facing CLB instance: Internet-facing instances include a static public IP address, so no EIP is required.

  2. Configure a listener and a server group for the CLB instance:

    1. A server group is a set of backend servers that process requests from CLB. Adjust server count dynamically to match traffic.

    2. A listener receives client requests on a specific protocol and port, then forwards them to a server group.

  3. Configure DNS resolution: Map a custom domain name to the CLB service IP address so users access your service through the domain.

Service architecture:

image

Prerequisites

  • Two ECS instances (ECS01 and ECS02) are created in the same region as the CLB instance. For zonal high availability, place them in different zones.

    Sample script for the test application on the ECS instances

    Commands to deploy the service on ECS01:

    yum install -y nginx
    systemctl start nginx.service
    cd /usr/share/nginx/html/
    echo "Hello World ! This is ECS01." > index.html

    Commands to deploy the service on ECS02:

    yum install -y nginx
    systemctl start nginx.service
    cd /usr/share/nginx/html/
    echo "Hello World ! This is ECS02." > index.html
  • Domain name registration is complete. If the domain points to an Alibaba Cloud server in the Chinese mainland, an ICP filing is also required.

Procedure

Step 1: Create an internet-facing CLB instance

  1. Log on to the Classic Load Balancer (CLB) console. In the top navigation bar, select the region for the instance.

  2. Click Create CLB. On the buy page, select the region and zone for the CLB instance and specify an instance name.

    Key parameters and recommended settings

    Parameter

    Description

    Recommendation

    SLB area/primary zone

    The region and traffic-handling zone of the CLB instance.

    • Select a region that supports multiple zones.

    • Deploy the CLB and ECS instances in the same region.

    Zone type

    CLB is a regional resource.

    • Single-zone: CLB deploys in one zone only.

    • Multi-zone: CLB deploys across multiple zones. The primary zone handles traffic by default; if it fails, traffic shifts to a secondary zone automatically. Zone-disaster recovery.

    Instance billing method

    pay-by-CLCU: Recommended for testing or for services with fluctuating workloads. Instance performance automatically scales with usage, so you do not need to specify an instance specification.

    pay-by-CLCU

    Instance Type

    • Internet: Public IP address, accessible from the internet.

    • Intranet: Private IP address within a VPC, no internet access.

    Internet

    IP Version

    The IP version of the CLB service address.

    • IPv4: Provides an IPv4 address only.

    • IPv6: Provides an IPv6 address only.

    IPv4

    Internet data transfer billing method

    Only internet-facing CLB instances are charged for data transfer over the internet.

    pay-by-traffic: Recommended for services with fluctuating workloads.

    pay-by-traffic

    Instance billing details: Pay-as-you-go.

  3. Complete the purchase to create the instance. The new instance is displayed in the Classic Load Balancer (CLB) console.

Step 2: Configure a listener and a server group

  1. On the Instances page, find the target instance and click Configure Listener in the Actions column.

  2. Configure the listener protocol and listener port.

    Key parameters and recommended settings

    Parameter

    Description

    Recommendation

    Listener Protocol

    The service protocol of the CLB instance.

    • TCP/UDP: Layer 4 protocols.

    • HTTP/HTTPS: Layer 7 protocols.

    Note

    How they work:

    • Layer 4 listener: Forwards requests directly to backend servers by rewriting the destination IP and port at the packet level.

    • Layer 7 listener: Acts as a reverse proxy — terminates the client connection and opens a new one to the backend server.

    Product architecture.

    HTTP

    Note

    Layer 7 listeners add overhead that may cause port exhaustion or excess connections under heavy load. For higher throughput, use a Layer 4 listener.

    Listener Port

    The service port of the CLB instance.

    80

    Listener parameter details: Listeners.

  3. Configure a server group. On the Server Group tab, click Create Server Group, enter a name such as server-group-test, and click Add.

    Select the backend servers for the CLB instance.

    For Backend server type, select ECS/ENI, select the target ECS instances, and then click Next.

    Configure backend server ports and add the servers.

    Set port to 80, use the default weight of 100, and then click Add.

  4. Keep the default health check settings.

    Recommendations for health checks

    Health checks monitor backend server availability.

    CLB routes traffic away from unhealthy servers and resumes routing when they recover.

    Health checks prevent individual server failures from affecting the entire service.

    Important

    For load-sensitive services, reduce probe frequency, increase the health check interval, or switch from Layer 7 to Layer 4 health checks. Do not disable health checks.

    Health checks.

    The default health check settings are as follows: The protocol is HTTP and the method is HEAD. The health check port is the backend server port, and the path is /. The response timeout is 5 seconds, the interval is 2 seconds, and the healthy and unhealthy thresholds are both 3. The healthy status codes are http_2xx and http_3xx.

  5. Submit the configuration. A Configuration succeeded dialog confirms that the Server Group, Layer-7 Load Balancing, and Start Listener steps completed. Click Got it.

Step 3: Configure DNS resolution

  1. On the Instances page, find the target instance and copy the IP address from the IP Address column.

  2. Add an A record to map your domain name to the CLB service IP address.

    1. Log on to the Alibaba Cloud DNS console, find the target domain name, and click Settings in the Actions column.

    2. Click Add Record. Configure the following parameters. Keep defaults for other parameters.

      • Record Type: Select A to map the domain name to an IPv4 address.

      • Hostname: The prefix of the domain name.

      • Record Value: The service IP address of the CLB instance.

Verify the results

From any internet-connected client:

Enter the domain name in a browser and refresh multiple times. Requests alternate between ECS01 and ECS02.

Note

If the listener uses a non-default port, include it in the URL. Example: http://www.example.com:9000.

Stop one ECS instance. Requests continue to be processed, confirming CLB failover.

More operations

Clean up resources

Delete unused resources to avoid unnecessary charges.

  1. Delete the DNS record: Log on to the Alibaba Cloud DNS console and click the target domain name. Find the target DNS record and click Delete in the Actions column.

  2. Delete the CLB instance: Log on to the Classic Load Balancer (CLB) console. In the Actions column of the target instance, choose 2 > Release Settings, and then release the instance immediately.

  3. Delete the ECS instances, security group, and other resources:

    1. Log on to the Elastic Compute Service (ECS) console. In the top navigation bar, select the region where the instances are deployed. Find the target instance, click image.png in the Actions column, select Release in the pop-up window, and then release the instance immediately.

    2. Log on to the Security Groups page of the ECS console. In the top navigation bar, select the region where the security group is deployed, find the target security group, and click Delete in the Actions column.

  4. Delete the VPC and related resources: Log on to the Virtual Private Cloud (VPC) console. In the top navigation bar, select the region where the instance is deployed. Click Delete in the Actions column of the VPC instance to delete the VPC, vSwitches, and other network resources.

FAQ

Internet-facing vs. intranet-facing instances

A newly created intranet-facing CLB instance is deployed in a VPC.

Feature

Internet-facing CLB instance

Intranet-facing CLB instance

Internet accessibility

An internet-facing CLB instance has a static public IP address bound to the instance.

When releasing the instance, convert its public IP to an elastic IP address (EIP) to retain it.

An intranet-facing CLB instance has no internet access by default.

Associate an elastic IP address (EIP) with an intranet-facing CLB instance to enable internet access. The EIP can be associated or disassociated at any time.

Service address

Provides only a public IP address.

Provides a private IP address within a VPC.

If an EIP is associated, the instance also provides the public IP address of the EIP.

Network capability

You can add backend servers, such as ECS instances and elastic network interfaces (ENIs), from different VPCs.

You can add backend servers, such as ECS instances and ENIs, only from the same VPC.

Note

After an instance is created, you cannot change its network type from internet-facing to intranet-facing or vice versa.

Choosing billing methods

Billing method

Instance metering method

Instance network type

Internet data transfer metering method

Use cases

Pay-as-you-go

Pay-by-LCU

Internet-facing

Pay-by-data-transfer

  • Workloads with periodic or large fluctuations, like gaming and video streaming.

  • Temporary traffic spikes.

Internal

N/A

Pay-by-specification (sale discontinued)

Internet-facing

Pay-by-data-transfer

  • Stable traffic volume.

  • Temporary traffic spikes.

Pay-by-bandwidth

Internal

N/A

Pay-by-specification instance specifications

Note

Pay-by-specification CLB instances are no longer available for purchase since June 1, 2025, 00:00:00 (UTC+8). For more information, see End of sale for pay-by-specification CLB instances.

Key performance metrics: maximum connections, connections per second (CPS), and queries per second (QPS). Instance specifications.

Does pay-by-bandwidth limit bandwidth?

Yes.

For example, a 20 Mbit/s pay-by-bandwidth instance limits both inbound and outbound traffic to 20 Mbit/s.

Can I migrate a CLB instance to another VPC?

No.

Create a new CLB instance in the target VPC instead.

Can CLB forward traffic to non-Alibaba Cloud servers?

No. CLB supports only Alibaba Cloud ECS instances, ENIs, and ECI instances as backend servers.

Can I use cross-account ECS instances as backend servers?

No. Backend servers must belong to your own Alibaba Cloud account.

Can I associate an EIP with multiple resources?

No. Each EIP can be associated with only one resource at a time.

Related topics