Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Network Load Balancer
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Network load balancers
      • Create a network load balancer
      • Create an internal network load balancer
      • Start a load balancer
      • Stop a load balancer
      • Delete a load balancer
      • Check target health statuses
      • Add a listener
      • Delete a listener
    • Target groups
      • Create a target group
      • Attach a target group to a load balancer
      • Detach a target group from a load balancer
      • Delete a target group
  • Concepts
    • Network load balancer
    • Internal network load balancer
    • Listener
    • Targets and groups
    • Resource health checks
    • Quotas and limits
  • Best practices for using the service
  • Access management
  • Pricing policy
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • NetworkLoadBalancerService
      • TargetGroupService
      • OperationService
    • REST
      • Overview
      • NetworkLoadBalancer
        • Overview
        • addListener
        • attachTargetGroup
        • create
        • delete
        • detachTargetGroup
        • get
        • getTargetStates
        • list
        • listOperations
        • removeListener
        • start
        • stop
        • update
      • TargetGroup
        • Overview
        • addTargets
        • create
        • delete
        • get
        • list
        • listOperations
        • removeTargets
        • update
      • Operation
        • Overview
        • get
  • Questions and answers
  1. Step-by-step instructions
  2. Network load balancers
  3. Create a network load balancer

Create a network load balancer

  • Examples
    • Creating a network load balancer without a listener
    • Creating a network load balancer with a listener and attached target group

Note

Before creating a network load balancer, create a target group to attach to it.

Management console
CLI
API

To create a network load balancer:

  1. Open the Load Balancer section in the folder where you want to create a load balancer.

  2. Click Create load balancer.

  3. Enter a name.

    • Length — from 3 to 63 characters.
    • The name may contain lowercase Latin letters, numbers, and hyphens.
    • The first character must be a letter. The last character can't be a hyphen.
  4. Under Listeners, assign a public IP address to the listener. You can assign an address automatically or select one from the list of reserved addresses. Click Add listener.

  5. In the window that opens, enter the listener name and specify the port number (in the range from 1 to 32767) that the load balancer will receive incoming traffic on. Click Add.

  6. Turn on Target groups.

  7. Select the VMs to be included in the new target group, or select a previously created target group.

  8. In the Health check section, enter the health check name.

    • Length — from 3 to 63 characters.
    • The name may contain lowercase Latin letters, numbers, and hyphens.
    • The first character must be a letter. The last character can't be a hyphen.
  9. Select the check type: HTTP or TCP.

  10. Specify a port number from the range 1-32767.

  11. If you chose a check via HTTP, specify the URL to perform checks for.

  12. Specify the response timeout in seconds.

  13. Specify the interval, in seconds, for sending health check requests.

  14. Set the performance threshold, which is the number of successful checks required in order to consider the VM ready to receive traffic.

  15. Specify the failure threshold, which is the number of failed checks after which no traffic will be routed to the VM.

  16. Click Create load balancer.

If you don't have the Yandex.Cloud command-line interface, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View a description of the CLI command to create a network load balancer:

    $ yc load-balancer network-load-balancer create --help
    
  2. To create a load balancer with a listener, run the following command in the terminal:

    $ yc load-balancer network-load-balancer create \
    --region-id ru-central1 \
    --name test-load-balancer-2 \
    --listener name=test-listener,external-ip-version=ipv4,port=80
    
  3. Get the list of all load balancers to make sure that the load balancer was created:

    $ yc load-balancer network-load-balancer list
    

You can create a new network load balancer using the create API method.

Examples

Creating a network load balancer without a listener

CLI

To create a load balancer without a listener, run the following command in the terminal:

   $ yc load-balancer network-load-balancer create \
   --region-id ru-central1 \
   --name test-load-balancer-1

Creating a network load balancer with a listener and attached target group

CLI
  1. To create a load balancer with a listener and immediately connect a previously created target group to it, get the list of target groups:

    $ yc load-balancer target-group list
    +----------------------+-------------------+---------------------+-------------+--------------+
    |          ID          |       NAME        |       CREATED       |  REGION ID  | TARGET COUNT |
    +----------------------+-------------------+---------------------+-------------+--------------+
    | b7roi767je4c574iivrk | test-target-group | 2018-12-03 14:41:04 | ru-central1 |            1 |
    +----------------------+-------------------+---------------------+-------------+--------------+
    
  2. Run the following command using the target group ID in the target-group-id parameter:

    $ yc load-balancer network-load-balancer create \
    --region-id ru-central1 \
    --name test-load-balancer-3 \
    --listener name=test-listener,external-ip-version=ipv4,port=80 \
    --target-group target-group-id=b7rjtf12qdeehrj31hri,healthcheck-name=http,healthcheck-interval=2s,healthcheck-timeout=1s,healthcheck-unhealthythreshold=2,healthcheck-healthythreshold=2,healthcheck-http-port=80
    

    Mind the healthcheck-interval and healthcheck-timeout parameter format: the values must be in Ns format.

Language / Region
Careers
Privacy policy
Terms of use
Brandbook
© 2021 Yandex.Cloud LLC