Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • 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. Target groups
  3. Attach a target group to a load balancer

Attach a target group to a network load balancer

    Management console
    CLI
    API

    To attach a target group to a network load balancer:

    1. Open the Load Balancer section in the folder where you want to attach the target group to the load balancer.
    2. Click in the row of that load balancer. If you already have a target group created, select it. If not, create one.
    3. Configure health check settings.
    4. Click Attach

    If you don't have the Yandex.Cloud command line interface yet, 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. See the description of the CLI's attach target group command to a network load balancer:

      $ yc load-balancer network-load-balancer attach-target-group --help
      
    2. Get a list of load balancers:

      $ yc load-balancer network-load-balancer list
      +----------------------+--------------------+-------------+----------+----------------+------------------------+----------+
      |          ID          |        NAME        |  REGION ID  |   TYPE   | LISTENER COUNT | ATTACHED TARGET GROUPS |  STATUS  |
      +----------------------+--------------------+-------------+----------+----------------+------------------------+----------+
      ...
      | b7r97ah2jn5rmo6k1dsk | test-load-balancer | ru-central1 | EXTERNAL |              1 |                        | INACTIVE |
      ...
      +----------------------+--------------------+-------------+----------+----------------+------------------------+----------+
      
    3. Get a 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 |
      ...
      +----------------------+-------------------+---------------------+-------------+--------------+
      
    4. Choose the ID or NAME of the required load balancer and target group.

    5. Attach the appropriate group to the selected load balancer by specifying the health check settings in the corresponding command parameters:

      $ yc load-balancer network-load-balancer attach-target-group b7r97ah2jn5rmo6k1dsk \
        --target-group target-group-id=b7roi767je4c574iivrk,healthcheck-name=test-health-check,healthcheck-interval=2s,healthcheck-timeout=1s,healthcheck-unhealthythreshold=2,healthcheck-healthythreshold=2,healthcheck-http-port=80
      

      Pay attention to the format of the healthcheck-interval and healthcheck-timeout parameters: their values must be specified in Ns format.

      For more information about check parameters, see the section Resource health check.

    You can attach a target group to a network load balancer using the attachTargetGroup API method.

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