Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Network Load Balancer
  • Getting started
    • All guides
      • Information about existing target groups
      • Creating a target group
      • Attaching a target group to a load balancer
      • Detaching a target group from a load balancer
      • Deleting a target group
    • Viewing operations with resources
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ
  1. Step-by-step guides
  2. Target groups
  3. Creating a target group

Creating a Network Load Balancer target group

Written by
Yandex Cloud
Improved by
Danila N.
Updated at May 5, 2025
Management console
CLI
Terraform
API

To create a new target group:

  1. In the management console, select the folder where you want to create a target group.

  2. In the list of services, select Network Load Balancer.

  3. In the left-hand panel, select Target groups.

  4. Click Create a target group.

  5. Enter a name for the target group. Follow these naming requirements:

    • It must be from 2 to 63 characters long.
    • It may contain lowercase Latin letters, numbers, and hyphens.
    • It must start with a letter and cannot end with a hyphen.
  6. Select the VMs to add to the target group.

  7. Click Create.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for creating a target group:

    yc load-balancer target-group create --help
    
  2. Create a target group and add the appropriate VMs as targets by specifying their settings in one or more --target parameters:

    yc load-balancer target-group create <target_group_name> \
       --target subnet-id=<subnet_ID>,`
               `address=<VM_internal_IP_address>
    

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

  1. In the configuration file, describe the settings for the target in the target group.

    Here is an example of the configuration file structure:

    resource "yandex_lb_target_group" "foo" {
      name      = "<target_group_name>"
      target {
        subnet_id = "<subnet_ID>"
        address   = "<target_internal_IP_address>"
      }
      target {
        subnet_id = "<subnet_ID>"
        address   = "<resource_2_internal_IP_address>"
      }
    }
    
    • name: Target group name.
    • target: Target description:
      • subnet_id: ID of the subnet hosting the targets. All targets in the target group must reside within the same availability zone.
      • address: Target internal IP address.

    For more information about yandex_lb_target_group settings, see this Terraform article.

  2. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  3. Create a target group.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

To create a new target group, use the create REST API method for the TargetGroup resource or the TargetGroupService/Create gRPC API call.

After you create a target group, add targets for load distribution. To do this, use the addTargets REST API method for the TargetGroup resource or the TargetGroupService/AddTargets gRPC API call.

Was the article helpful?

Previous
Information about existing target groups
Next
Attaching a target group to a load balancer
Yandex project
© 2025 Yandex.Cloud LLC