Skip to main content
Create a load balancer
Last update:

Create a load balancer

  1. Select configuration and network.
  2. Create a target group.
  3. Set up rules and HTTP policies.

1. Select configuration and network

  1. In the control panel go to the section Cloud PlatformLoad Balancers.

  2. Open the Load Balancers tab.

  3. Click Create a load balancer.

  4. Select the region and pool in which the load balancer will be created.

  5. Select configuration depending on the load on the project.

  6. Enter the name of the load balancer.

  7. Optional: enter a comment — any additional information about the load balancer, it will be displayed only in the control panel.

  8. Select a subnet:

    • private — traffic balancing will be performed only within the subnet. You can connect a public IP address to a private address — the load balancer will be accessible from the Internet via NAT;
    • or public — the load balancer will be accessible from the Internet and will be able to proxy requests from the public subnet to cloud servers in the private subnet. If you will be hosting cloud servers on the same subnet, then select a network with a size of /28 or make sure that it has a free IP address for load balancer port.
  9. Specify the IP address in the subnet — the free address that will be assigned to the load balancer.

  10. Optional: Connect a public IP address. If there is no available public IP address, create a new IP address. The private subnet where you are creating the load balancer must be connected to a cloud router with access to an external network.

  11. Click Next.

2. Create a target group

  1. Open the Servers tab.

  2. Optional: To change the name of the target group, click , enter the name and click .

  3. Select the traffic destination protocol that the load balancer will use to transfer traffic to the target group. The following protocol combinations are available for receiving traffic on the load balancer and assigning traffic to the target group:

    • TCP–TCP — classic L4 balancing;
    • TCP PROXY — client information is not lost and is transmitted in a separate connection header;
    • UDP–UDP — UDP protocol is faster than TCP, but less reliable;
    • HTTP–HTTP — L7-balancing;
    • HTTPS–HTTP — L7-balancing with encryption and termination of the SSL certificate on the load balancer.
  4. The standard port will be automatically selected for the selected protocol — change it if necessary. The port value will be shared by all servers in the group.

  5. Select the servers that will be added to the target group.

  6. Specify the settings for each marked server:

    6.1. Select the IP address.

    6.2. Optional: Change the port.

    6.3. Specify the weight of the server — this is a proportional measure, it indicates the proportion of requests that the server processes. If the weights are the same, then the servers serve an equal number of requests. If, for example, there is one server with a weight of "2" and two servers with a weight of "1" in the group, then the first server will receive 50% of all requests, and the other two will receive 25% each. The maximum weight value is 256.

    6.4. Optional: to direct traffic to the server only when the other servers in the group are unavailable, check the Backup checkbox.

  7. Open the Algorithm tab.

  8. Select request distribution algorithm — Round Robin or Least connections.

  9. Optional: To enable the [Sticky Sessions] method(/cloud/servers/load-balancers/about-load-balancers.mdx#sticky-sessions), check the Sticky sessions checkbox and select the session ID. For the APP cookie ID, enter the cookie name.

  10. Open the tab Availability checks.

  11. Select the type of availability check. After the group is created, the verification type cannot be changed.

  12. If the HTTP verification type is selected, specify the request parameters — method, path, and expected response codes.

  13. Specify the interval between checks — the interval in seconds with which the load balancer sends checking requests to the servers.

  14. Specify the connection timeout — the response waiting time in seconds, should be less than the interval between checks.

  15. Specify the success threshold — the number of successful requests in a row, after which the server is put into operation.

  16. Specify the failure threshold — the number of unsuccessful requests in a row, after which the server operation is suspended.

  17. Optional: To add another target group, click Add Target Group and configure it.

  18. Click Next.

3. Configure rules and HTTP policies

  1. Select protocol for receiving traffic on the load balancer:
  1. For the selected protocol, the standard port on which the load balancer will listen to traffic will be automatically selected — change it if necessary.

  2. Select the target group. Groups are available for which traffic can be balanced according to the selected protocol for receiving traffic.

  3. Optional: Expand the Advanced Rule Settings block and specify connection settings:

    • for incoming requests to the load balancer, specify the connection timeout and maximum connections;
    • for requests from the load balancer to servers, specify the connection timeout, inactivity timeout, and TCP packet timeout.
  4. Optional: To add another rule, click Add Rule and go to step 1. The number of rules is unlimited.

  5. Check the total cost of the load balancer.

  6. Click Create a load balancer.