Network Load Balancer (NLB) is a next-generation Layer 4 load balancing service designed for the Internet of Everything (IoE). You can create an NLB instance to distribute requests from clients to backend servers. This topic describes how to create and manage NLB instances.
Prerequisites
You have created a VPC.
Before you create an NLB instance, ensure the vSwitches in the selected zones have sufficient IP addresses. When you create an instance, three IP addresses are used from each specified vSwitch: two local IP addresses for communicating with backend servers and performing health checks, and one virtual IP (VIP) address to provide services. The VIP address remains unchanged after it is created. Insufficient IP addresses will cause the instance creation to fail.
NoteTo ensure the NLB instance can scale, we recommend that you reserve at least eight IP addresses in each vSwitch where the instance is deployed.
The AliyunServiceRoleForNlb service-linked role exists in your account. When you create an NLB instance for the first time, you are prompted to create this role. This role allows NLB to access other Alibaba Cloud services, such as elastic network interfaces, elastic IP addresses, and Internet Shared Bandwidth.
Create an instance
Log on to the NLB console.
-
In the top navigation bar, select the region in which the NLB instance is deployed.
On the Instances page, click Create NLB.
On the NLB (Pay-As-You-Go) buy page, configure the following parameters.
Parameter
Description
Region
Select the region where you want to deploy the instance.
Network Type
Select a network type for the instance. The system assigns a service address based on your selection.
Private: provides a private IP address in each zone. The NLB instance is accessible only from within Alibaba Cloud.
Public: provides a public IP address and a private IP address in each zone. By default, a public NLB instance uses an elastic IP address (EIP) to provide public access. If you select this option, you are charged for the EIP instance and for bandwidth or data transfer.
The EIP allows the NLB instance to be accessed from the internet.
The private IP address allows ECS instances within the VPC to access the NLB instance.
NoteAfter an NLB instance is created, you can change its network type. For more information, see Change the network type of an NLB instance.
By default, a dual-stack instance uses its IPv4 address for public services. To use an IPv6 address for public services, you must change the network type, which incurs IPv6 gateway fees. For more information, see IPv6 gateway billing.
VPC
Select the VPC in which to deploy the instance.
Zone
Select the zones and vSwitches for your instance.
NLB supports multi-zone deployment. If the current region supports two or more zones, select at least two zones to ensure high availability for your services. NLB does not charge additional fees for the zones.
For each selected zone, select a vSwitch. If no vSwitch is available, create one as prompted.
Optional: If you set Network Type to Public, you must select an EIP for each selected zone.
If no EIP is available, you can keep the default selection Auto-assign EIP. The system automatically creates a pay-as-you-go (pay-by-data-transfer) EIP with BGP (Multi-ISP) lines and basic Anti-DDoS protection, and then associates it with the NLB instance.
You can select an existing EIP to associate with the new NLB instance.
ImportantYou can associate only existing pay-as-you-go (pay-by-data-transfer) EIPs that are not added to an Internet Shared Bandwidth instance.
The EIPs that are allocated to different zones of the same NLB instance must be of the same type.
An automatically assigned EIP is released with the NLB instance or when the network type is changed from public to private. Existing EIPs are not affected when the NLB instance is released or its network type is changed from public to private.
IP Version
Select an IP version for the instance.
IPv4: The NLB instance can be accessed only by clients that use IPv4 addresses.
Dual-stack: The NLB instance can be accessed by clients that use both IPv4 and IPv6 addresses.
Associate with EIP Bandwidth Plan
Select whether to add the resource to an Internet Shared Bandwidth. If you select Associate with EIP Bandwidth Plan, you must select an Internet Shared Bandwidth package. If no Internet Shared Bandwidth packages are available, click Purchase Internet Shared Bandwidth Package and complete the purchase. Then, return to the NLB purchase page and click the
icon to select an Internet Shared Bandwidth package.We recommend that you purchase a pay-as-you-go Internet Shared Bandwidth instance. For more information, see Create and manage an Internet Shared Bandwidth instance.
NoteThis parameter is available only when Network Type is set to Public.
Internet Metering Method
The default billing method is Pay-By-Data-Transfer. The peak bandwidth is for reference only and is not a service level agreement (SLA) commitment. When resource contention occurs, the peak bandwidth may be limited. For more information about EIP billing, see EIP billing.
NoteThis parameter is available only when Network Type is set to Public and Associate with EIP Bandwidth Plan is not selected.
Service-linked Role
When you create an NLB instance for the first time, you must click Create Service-linked Role.
Instance Name
Enter a name for the instance.
Resource Group
Select a resource group for the instance.
Click Create Now and complete the purchase as prompted.
Return to the Instances page. The newly created instance appears in the selected region.
Release an instance
You can release an instance to avoid unnecessary charges.
If you have mapped a custom domain name to the DNS name or IP address of the NLB instance, we recommend that you point the domain to another load balancer instance before you release the NLB instance to prevent service interruptions.
After an NLB instance is released, its configurations and data are deleted and cannot be recovered.
If the NLB instance is managed by another Alibaba Cloud service, such as Container Service for Kubernetes (ACK), releasing the instance disrupts the service and the action is irreversible.
You cannot release an instance if deletion protection is enabled for it.
Log on to the NLB console.
-
In the top navigation bar, select the region in which the NLB instance is deployed.
On the Instances page, find the target instance. In the Actions column, click
and select Release.In the Release Instance dialog box, click OK.
More operations
Actions | Procedure |
Modify the instance name | On the Instances page, find the target instance. Hover over the instance name, click the |
Manage tags |
Add or edit tags
Filter by tag On the Instances page, click Filter Tags above the instance list. Select a Tag Key and Tag Value. To remove the filter, click Clear Search Condition above the instance list. |
Enable or disable cross-zone load balancing | By default, after cross-zone load balancing is enabled, traffic to the NLB instance is distributed to backend servers in all enabled zones within the same region. On the Instances page, click the ID of the target instance. In the Instance Property section, enable or disable Cross-Zone Distribution. |
Configure deletion protection | Enabling deletion protection prevents an instance from being accidentally released.
|
Configure configuration read-only mode | Important If your NLB instance is managed by Container Service for Kubernetes (ACK), modifying the NLB instance configuration after you disable configuration read-only mode may disrupt the ACK cluster. Enabling configuration read-only mode prevents accidental configuration changes.
|
What to do next
After you create an instance, you need to configure a listener. The listener checks for connection requests and distributes them to backend servers based on your specified scheduling algorithm.
Related topics
Overview:
To learn about the use cases and components of NLB, see What is NLB?.
To learn about the features of NLB, see Features.
Console operations:
To change the network type of an instance, see Change the network type of an NLB instance.
To update the zones of an instance, see Update the zones of an instance.
To simulate disaster recovery by changing the zone status, see Change the status of a zone.
To add a public NLB instance to an Internet Shared Bandwidth instance or adjust its bandwidth peak, see Increase the bandwidth of a public NLB instance.
API reference:
CreateLoadBalancer: Creates an NLB instance.
DeleteLoadBalancer: Deletes an NLB instance.
UpdateLoadBalancerAttribute: Modifies the status and name of an NLB instance.
UpdateLoadBalancerAddressTypeConfig: Changes the network type of an NLB instance for IPv4.
UpdateLoadBalancerZones: Modifies the zone attributes of an NLB instance.
EnableLoadBalancerIpv6Internet: Changes the network type of an IPv6 NLB instance from private to public.
DisableLoadBalancerIpv6Internet: Changes the network type of an IPv6 NLB instance from public to private.