If you want to prevent single points of failures (SPOFs) while improving service redundancy and stability, we recommend that you use Classic Load Balancer (CLB). CLB supports basic load balancing at Layer 4 and Layer 7. You can use a CLB instance to distribute requests to backend servers. This topic describes how to create and manage a CLB instance.
Prerequisites
Before you create a CLB instance, make sure that the preparations are complete. For more information, see Preparations.
Create a CLB instance
A CLB instance is an entity that provides load balancing services. To use the CLB service, you must create a CLB instance.
Log on to the CLB console.
On the Instances page, click Create CLB.
Parameter
Description
Region
Select the region in which you want to create the CLB instance.
NoteMake sure that the CLB instance and the Elastic Compute Service (ECS) instances that you want to specify as backend servers belong to the same region.
Zone Type
Specifies whether the CLB instance is deployed in one zone or across multiple zones. A zone represents an Alibaba Cloud data center that contains a set of independent infrastructure resources. The infrastructure resources such as networks, power supply, and air conditioning in different zones are independent of each other. Therefore, if the infrastructure resources in one zone become unavailable, the other zones take over. Each zone belongs to a specific region. A region may contain one or more zones.
Single zone: The CLB instance is deployed only in one zone.
Multi-zone: The CLB instance is deployed across two zones. By default, network traffic is distributed to the primary zone. If the primary zone fails, the system automatically switches network traffic to the secondary zone and continues providing load balancing services. This ensures high service availability.
Primary Zone
Select a primary zone for the CLB instance. The primary zone is used to distribute network traffic.
Backup Zone
Select a secondary zone for the CLB instance. By default, network traffic is distributed to the secondary zone only if the primary zone fails.
NoteIf you select Single zone, the Backup Zone parameter is dimmed.
Instance Name
Enter a name for the CLB instance.
Instance Type
You can create an Internet-facing CLB instance or an internal-facing CLB instance based on your business requirements. The system allocates a public or private IP address to the CLB instance based on the specified instance type. In this example, Internet is selected.
Internet: If you select this option, only a public IP address is allocated to the CLB instance. In this case, the CLB instance can provide services over the Internet.
Intranet: If you select this option, only a private IP address is allocated from the IP address pool of Alibaba Cloud to the CLB instance. In this case, the CLB instance can be accessed only over the internal network of Alibaba Cloud.
For more information, see Instance types.
Instance Billing Method
Select a metering method for the CLB instance. Valid values: Pay-By-CLCU and Pay-By-Specification. In this example, Pay-By-CLCU is selected.
Specification
Select a specification for the CLB instance.
The performance metrics of a CLB instance varies based on the instance specification. For more information, see Instance types.
This parameter is available only if you set the Instance Billing Method parameter to Pay-By-Specification.
NoteYou can ignore this parameter if you set the Instance Billing Method parameter to Pay-By-CLCU.
Network Type
The network type of the CLB instance. Default value: VPC.
This parameter is available only if you set the Instance Type parameter to Intranet.
IP Version
Select an IP version for the CLB instance. Valid values: IPv4 and IPv6.
NoteIf you set the Network Type parameter to VPC, only IPv4 is supported.
VPC ID
Select a virtual private cloud (VPC).
This parameter is available only if you set the Instance Type parameter to Intranet.
Vswitch ID
Select a vSwitch.
This parameter is available only if you set the Instance Type parameter to Intranet.
Internet Data Transfer fee
Select a metering method for Internet data transfers. Internet-facing CLB instances support the following metering methods:
By traffic
By bandwidth
If the billing method of the CLB instance is pay-as-you-go, only the By traffic option is supported.
NoteFor an internal-facing CLB instance, only By traffic is displayed. You are not charged for data transfers.
Maximum Bandwidth
Enter a bandwidth value or adjust the slider to specify a bandwidth value based on your business requirements.
Resource Group
Select a resource group for the CLB instance.
Quantity
Specify the number of CLB instances that you want to purchase.
On the Confirm Order page, review the configurations of the CLB instance, select I have read and agree to CLB (Pay-As-You-Go) International Site Agreement of Service, and then complete the payment.
Enable or disable a CLB instance
You can enable or disable a CLB instance based on your business requirements. If a CLB instance is disabled, the CLB instance does not receive or forward requests.
Log on to the CLB console.
In the top navigation bar, select the region in which the CLB instance is deployed.
On the Instances page, find the CLB instance that you want to manage and choose or in the Actions column.
To enable or disable multiple CLB instances at a time, select the CLB instances that you want to enable or disable and click Start or Stop below the instance list.
Release a CLB instance
You can release a pay-as-you-go CLB instance immediately or at a scheduled time. After a CLB instance is released, the configurations and data are released and cannot be restored.
When you release an Internet-facing CLB instance, you can disassociate the CLB instance from the public IP address, which is converted to an elastic IP address (EIP) and can be retained for future use.
You cannot release CLB instances that have deletion protection enabled. To release a CLB instance that has deletion protection enabled, click Disable Deletion Protection on the Instance Details tab.
If a custom domain name is resolved to the IP address of your CLB instance, we recommend that you resolve the domain name to the IP address of another CLB instance before you release the current instance. This helps you prevent service interruptions.
If your CLB instance is managed by another Alibaba Cloud service, such as Container Service for Kubernetes (ACK), services become unavailable after the CLB instance is released, and the released CLB instance cannot be restored.
Log on to the CLB console.
In the top navigation bar, select the region in which the CLB instance is deployed.
On the Instances page, find the instance that you want to release and choose .
To release multiple CLB instances at a time, select the CLB instances that you want to release and click Release Settings below the instance list.
In the Release Settings panel, configure the parameters and click Next. The following table describes the parameters.
Parameter
Description
Release
Specify how you want to release the CLB instance. Valid values:
Release Now
Scheduled Release
Release At
If you select Scheduled Release, you must configure this parameter.
The CLB instance is released on the next hour but billing is stopped at the specified release time. For example, if you set the release time to 09:28:00 on May 19, 2022, billing is stopped at 09:28:00 on May 19, 2022 but the instance is released at 10:00:00 on May 19, 2022.
Do you want to switch from public IP address to EIP and retain the EIP?
If you select Release Now for a pay-as-you-go Internet-facing CLB instance, you can convert the public IP address of the CLB instance to an EIP and retain the EIP. The EIP can be associated with an instance in the region. For example, you can associate the EIP with an ALB instance or another CLB instance. In this case, the public IP address can remain unchanged when you migrate an instance.
You can select Do not Retain or Retain. The first time you retain an EIP, the service-linked role AliyunServiceRoleForSlbEipAccess is automatically created to allow CLB to access the EIP service.
Limits
Only EIPs of Internet-facing IPv4 CLB instances can be retained. EIPs of internal-facing and Internet-facing IPv6 CLB instances cannot be retained.
NoteIf you release multiple CLB instances at a time, you cannot disassociate the CLB instances from the EIPs and retain the EIPs. When you release multiple CLB instances at a time, check whether an internal-facing, Internet-facing IPv6, or subscription CLB instance is included.
EIPs cannot be retained if you select Scheduled Release.
Impact on billing
After you disassociate a CLB instance from the EIP, the EIP is still billed on a pay-as-you-go (pay-by-data-transfer) basis. The maximum bandwidth of a single EIP is 200 Mbit/s.
You can view the information and configurations of EIPs in the EIP console.
For more information about the billing of EIPs, see Pay-as-you-go.
What to do next
After you retain an EIP, you can associate the EIP with an internal-facing instance in the region.
For more information about how to associate a CLB instance with an EIP, see Associate and manage an EIP.
For more information about how to associate an ALB instance with an EIP, see Change the network type of an ALB instance.
For more information about how to associate an NLB instance with an EIP, see Change the network type of an NLB instance.
Review the information and click OK. In the Security Verification dialog box, enter the verification code that you received and click OK. The CLB instance is released.
Manage tags
You can add tags to CLB instances to group instances and facilitate instance management.
Each tag is a key-value pair. Take note of the following limits before you use tags to manage CLB instances:
Tags cannot exist as an independent resource. If you create a tag, it must be added to an instance.
The key of each tag added to the same CLB instance must be unique. If you add a new tag that uses the same key as an existing tag, the new tag overwrites the existing tag.
Tags cannot be used across regions. For example, tags that are created in the China (Hangzhou) region are not displayed in the China (Shanghai) region.
Add tags
- Log on to the CLB console.
In the top navigation bar, select the region in which the CLB instance is deployed.
On the Instances page, find the instance that you want to manage and modify the tag.
If no tag is added to the CLB instance, add a tag first. Move the pointer over the icon in the Tag column and click Edit.
If a tag is added to the CLB instance, move the pointer over the icon in the Tag column and click Edit.
In the Configure Tags dialog box, enter a key-value pair or select an existing key-value pair from the drop-down list.
You can manage all tags for your cloud resources in the Resource Management console. You can click Tag Management to go to the Resource Management console and create tags. For more information, see Add a custom tag.
Click OK.
Filter CLB instances by tag
On the Instances page, click Filter by Tag above the instance list.
Select a tag key and a tag value from the drop-down list.
Then, CLB instances that match the specified key-value pair are displayed.
Optional. You can click Clear Filter Condition above the instance list to clear the filter conditions.
Remove tags
You can remove tags only from one CLB instance at a time.
On the Instances page, find the CLB instance that you want to manage, move the pointer over the icon in the Tag column, and then click Edit.
In the Configure Tags dialog box, find the tag that you want to remove, click the icon next to the tag, and then click OK.
After you remove a tag from a cloud resource, the system automatically deletes the tag within 24 hours if the tag is not added to other resources.
What to do next
Configure a listener to listen for connection requests and forward the requests to backend servers based on a specified scheduling algorithm.
References
Product overview
For more information about CLB and the benefits of CLB, see What is CLB?
For more information about the functions and features of CLB, see Features.
For more information about the use scenarios of CLB, see Scenarios.
User guides
If you want your internal-facing CLB instance to forward requests from the Internet, you can associate an elastic IP address (EIP) with the CLB instance. For more information, see Associate and manage an EIP
API references:
CreateLoadBalancer: creates a CLB instance.
SetLoadBalancerStatus: enables or disables a CLB instance.
DeleteLoadBalancer: releases a pay-as-you-go CLB instance.
SetLoadBalancerDeleteProtection: enables or disables deletion protection for a CLB instance.
TagResources: creates tags and adds the tags to resources.
UntagResources: removes tags from resources.