• Elastic Load Balancing

elb
  1. Help Center
  2. Elastic Load Balancing
  3. User Guide
  4. Quick Start
  5. Creating a Classic Load Balancer

Creating a Classic Load Balancer

Scenarios

This section describes how to create a classic load balancer.

Prepare for Creation

  • Select the network type.
    • Public network

      A public network load balancer provides load balancing through a public IP address and routes requests from the clients to backend ECSs over the Internet.

    • Private network

      A private network load balancer provides load balancing through a private IP address and routes requests from the clients to backend ECSs in a VPC.

  • Select a protocol.

    Protocol

    Description

    Application Scenario

    Layer 4

    TCP

    • Source IP address–based sticky sessions
    • Fast data transfer
    • Scenarios that require high reliability and data accuracy, such as file transfer, email sending and receiving, and remote login
    • Web applications with a number of concurrent connections or that require high performance

    Layer 4

    UDP

    • Low reliability
    • Fast data transfer

    Scenarios that focus on timeliness rather than reliability, such as video chat, game, and real-time financial market information push

    Layer 4

    SSL

    • TCP-based security encryption
    • High reliability

    Applications that require encrypted transmission

    Layer 7

    HTTP

    • Cookie-based sticky sessions
    • X-Forward-For request header

    Applications in which the data content needs to be identified, such as web applications and mobile games

    Layer 7

    HTTPS

    • An extension of HTTP for encrypted data transmission that can prevent unauthorized access
    • SSL offloading

      Encryption and decryption are performed on the load balancer to reduce the work load of backend ECSs.

    • Multiple encryption protocols and cipher suites

    Applications that require encrypted transmission

Create a Load Balancer

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Under Network, click Elastic Load Balancing.
  4. Click Create Classic Load Balancer and specify the parameters by referring to Table 1.
    Table 1 Parameters for creating a classic load balancer

    Parameter

    Description

    Example Value

    Name

    Specifies the load balancer name.

    elb-pjg9

    Network Type

    Specifies the network type of a load balancer. There are two options:

    • Public network: A public network load balancer provides load balancing through a public IP address and routes requests from the clients to backend ECSs over the Internet.
    • Private network: A private network load balancer provides load balancing through a private IP address and routes requests from the clients to backend ECSs in a VPC.

    Private network

    VPC

    Specifies the VPC where the load balancer works.

    You can select an existing VPC or create one.

    For more information about VPC, see the Virtual Private Cloud User Guide.

    N/A

    EIP

    Specifies the public IP address bound to a load balancer. This parameter is available when you select Public network for Network Type. You can select an existing EIP or apply for a new one. Select an EIP when you select Use existing for EIP.

    • New EIP: The system will assign a new EIP to the load balancer.
    • Use existing: An existing IP address will be used.

    New EIP

    Subnet

    Specifies the subnet where the load balancer works when you select Private network for Network Type.

    N/A

    Virtual IP Address

    Specifies the virtual IP address that will be bound to a load balancer. This parameter is required when you select Private network for Network Type. You can select Automatically assign or Manually specify. You need to enter an IP address when you select Manually specify.

    Automatically assign

    Security Group

    Specifies the security group of the load balancer. This parameter is available when you select Private network for Network Type.

    N/A

    Bandwidth

    Specifies the public network bandwidth in the unit of Mbit/s.

    100

    Description

    Provides supplementary information about the load balancer.

    N/A

  5. Click Create Now.
  6. After confirming the configurations, click Submit.

Add a Listener

After creating a load balancer, you must add a listener to it. Perform the following operations to add a listener:

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Under Network, click Elastic Load Balancing.
  4. Click Classic, locate the target load balancer, and click its name.
  5. Under Listeners, click Add Listener. In the Add Listener dialog box, specify the parameters by referring to Table 2.
    Table 2 Parameters for adding a listener to a classic load balancer

    Parameter

    Description

    Example Value

    Name

    Specifies the listener name.

    listener-ssgu

    Frontend Protocol/Port

    Specifies the protocol and port the load balancer uses to receive requests from the client and forward the requests to backend servers. The port numbers range from 1 to 65535.

    Public network load balancers support the following protocols:

    • HTTP: load balancing at Layer 7
    • TCP: load balancing at Layer 4
    • HTTPS: encrypted load balancing at Layer 7
    • UDP: load balancing at Layer 4
    • SSL: encrypted load balancing at Layer 4

    Private network load balancers support the following protocols:

    • HTTP: load balancing at Layer 7
    • TCP: load balancing at Layer 4
    • HTTPS: encrypted load balancing at Layer 7

    TCP/80

    UDP/80

    HTTP/80

    HTTPS/443

    SSL/443

    Backend Protocol/Port

    Specifies the protocol and port used by backend servers to receive requests. The port numbers range from 1 to 65535.

    • TCP: layer-4 load balancing. When Frontend Protocol is set to SSL, Backend Protocol is TCP by default.
    • UDP: layer-4 load balancing. When Frontend Protocol is set to UDP, Backend Protocol is UDP by default.

    TCP/22

    Load Balancing Algorithm

    Specifies the algorithm the load balancer uses to distribute traffic.

    • Round robin: New connection requests are distributed sequentially across all ECSs, so that request workload is evenly shared.
    • Least connections: New connection requests are forwarded to the ECS processing the least number of connections at that time.
    • Source IP hash: The source IP address of the request is input into a hash algorithm, and the resulting hash is used to identify an ECS in the static fragment table.
    NOTE:

    As access traffic changes, choose the most appropriate algorithm to improve load balancing.

    Round robin

    Default Certificate

    Specifies the certificate used by an HTTPS load balancer.

    You can select an existing certificate or create one. For how to create a certificate, see Certificate.

    This parameter is available only when HTTPS is used as the frontend protocol.

    N/A

    Enable SNI

    Specifies whether to enable the Server Name Indication (SNI) function when Frontend Protocol is set to HTTPS.

    SNI is an extension to Transport Layer Security (TLS) when a server uses multiple domain names and certificates. This function allows the client to submit the domain name information while sending an SSL handshake request. Once receiving the request, the load balancer queries the right certificate based on the domain name and returns it to the client. If no certificate is found, the load balancer will issue a default certificate.

    N/A

    SNI Certificate

    Specifies the certificate associated with the domain name when Frontend Protocol is set to HTTPS.

    You can select an existing certificate or create one.

    N/A

    SSL Protocol

    Specifies the encryption protocol used by an HTTPS load balancer. This parameter is used to enable a specified encryption protocol. The following protocols are supported:

    • TLSv1.2
    • TLSv1.2 TLSv1.1 TLSv1

    This parameter is available only when HTTPS is used as the frontend protocol.

    TLSv1.2

    SSL Cipher

    Specifies the cipher suite used by an HTTPS load balancer. The following options are available:

    • Default Cipher
    • Extended Cipher
    • Strict Cipher

    This parameter is available only when HTTPS is used as the frontend protocol. Extended Cipher is the only available choice when SSL Protocol is set to TLSv1.2 TLSv1.1 TLSv1.

    Default Cipher

    Sticky Session

    Specifies whether to enable the sticky session feature.

    After this feature is enabled, all requests from a client during one session are sent to the same backend server.

    NOTE:

    This feature is supported only when Load Balancing Algorithm is set to Round robin.

    N/A

    Stickiness Duration (min)

    Specifies the duration that sticky sessions are maintained in minutes. The value ranges from 1 to 1440.

    5

    Description

    Provides supplementary information about the listener.

    N/A

    Health Check Protocol/Port

    Specifies the protocol and port used for performing health checks on ECSs. The port numbers range from 1 to 65535.

    NOTE:

    When UDP is used for health checks, the security group rules of backend ECSs must allow access using Internet Control Message Protocol (ICMP).

    HTTP/80

    Interval (s)

    Specifies the maximum number of seconds between health checks.

    The value ranges from 1 to 5.

    5

    Timeout (s)

    Specifies the maximum number of seconds to wait for receiving the result of a health check.

    The value ranges from 1 to 50.

    10

    Healthy Threshold

    Specifies the number of consecutive successful health checks necessary for a backend ECS to be considered healthy. The value ranges from 1 to 10.

    3

    Unhealthy Threshold

    Specifies the number of consecutive failed health checks necessary for a backend ECS to be considered unhealthy. The value ranges from 1 to 10.

    3

    Check Path

    Specifies the health check URL. This parameter is available only when Health Check Protocol is set to HTTP. The value can contain 1 to 80 characters.

    NOTE:

    The following characters are allowed in the path: -/.%?#&=

    /test.html

  6. Click OK.

Add Backend ECSs

Perform the following operations to add running servers to the listener so that the listener can distribute traffic to these servers:

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Under Network, click Elastic Load Balancing.
  4. Click Classic, locate the target load balancer, and click its name.
  5. Click Listeners, locate the target listener, and click Add Backend ECS in the Operation column.
  6. In the Add Backend ECS dialog box, confirm the subnet, specify the backend port, and select the target backend ECSs. You can filter backend ECSs by name or private IP address.
  7. Click OK.

Delete a Load Balancer

If you do not need a load balancer any longer, perform the following operations to delete it:

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Under Network, click Elastic Load Balancing.
  4. Click Classic, locate the target load balancer, and click More > Delete in the Operation column.
  5. In the Delete Load Balancer dialog box, click Yes.
NOTE:

If the load balancer has listeners associated, delete the listeners first.

Export Load Balancer Information

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Under Network, click Elastic Load Balancing.
  4. Click Classic. In the upper right corner of the load balancer list, click .