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 Application Load Balancer
  • Getting started
    • All guides
    • Creating Application Load Balancer infrastructure through a wizard
      • Creating a target group
      • Getting information about a target group
      • Editing a target group
      • Deleting a target group
    • Viewing operations with resources
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • L7 load balancer logs
  • Release notes
  1. Step-by-step guides
  2. Target groups
  3. Creating a target group

Creating an Application Load Balancer target group

Written by
Yandex Cloud
Updated at May 13, 2025

Create VMs in your previously selected folder by following this guide.

To create a target group:

Management console
CLI
Terraform
API
  1. In the management console, select the folder where you want to create your target group.
  2. From the list of services, select Application Load Balancer.
  3. In the left-hand panel, select Target groups.
  4. Click Create target group.
  5. Specify the target group name and description.
  6. Under Targets, select a VM from the list or add the target manually:
    1. In the IP address field, specify the target's IP and select its subnet.

    2. Optionally, if the target's IP address does not belong to Yandex Virtual Private Cloud, select Outside VPC.

      For example, you can specify a private IPv4 address from your data center connected to Yandex Cloud through Yandex Cloud Interconnect. This IP address must belong to the RFC 1918 private address range. For more information, see the subnets article.

    3. Click Add target resource.

  7. Click Create.

If you do not have the Yandex Cloud (CLI) command line interface 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 alb target-group create --help
    
  2. Run this command, with the target group name, subnet name, and VM’s internal IP addresses specified:

    yc alb target-group create \
      --name <target_group_name> \
      --target subnet-name=<subnet_name>,ip-address=<VM_1_internal_IP_address> \
      --target subnet-name=<subnet_name>,ip-address=<VM_2_internal_IP_address> \
      --target subnet-name=<subnet_name>,ip-address=<VM_3_internal_IP_address>
    

    Result:

    id: a5d751meibht********
    name: <target_group_name>
    folder_id: aoerb349v3h4********
    targets:
    - ip_address: <VM_1_internal_IP_address>
      subnet_id: fo2tgfikh3he********
    - ip_address: <VM_2_internal_IP_address>
      subnet_id: fo2tgfikh3he********
    - ip_address: <VM_3_internal_IP_address>
      subnet_id: fo2tgfikh3he********
    created_at: "2021-02-11T11:16:27.770674538Z
    

    You can also create a target group with resources outside Yandex Virtual Private Cloud, e.g., in your data center connected to Yandex Cloud via Yandex Cloud Interconnect. Target IP addresses must belong to the RFC 1918 private address range. For more information, see the subnets article.

    Run this command, with the target group name and resource’s private IPv4 addresses specified:

    yc alb target-group create \
      --name <target_group_name> \
      --target private-ip-address=true,ip-address=<resource_1_IPv4_private_address> \
      --target private-ip-address=true,ip-address=<resource_2_IPv4_private_address> \
      --target private-ip-address=true,ip-address=<resource_3_IPv4_private_address>
    

    Result:

    id: ds7s2dld2usr********
    name: <target_group_name>
    folder_id: aoerb349v3h4********
    targets:
      - ip_address: <resource_1_IPv4_private_address>
        private_ipv4_address: true
      - ip_address: <resource_2_IPv4_private_address>
        private_ipv4_address: true
      - ip_address: <resource_3_IPv4_private_address>
        private_ipv4_address: true
    created_at: "2023-07-25T08:55:14.172526884Z"
    

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

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

  1. In the Terraform configuration file, specify your new resource settings:

    resource "yandex_alb_target_group" "foo" {
      name           = "<target_group_name>"
    
      target {
        subnet_id    = "<subnet_ID>"
        ip_address   = "<VM_1_internal_IP_address>"
      }
    
      target {
        subnet_id    = "<subnet_ID>"
        ip_address   = "<VM_2_internal_IP_address>"
      }
    
      target {
        subnet_id    = "<subnet_ID>"
        ip_address   = "<VM_3_internal_IP_address>"
      }
    }
    

    Where yandex_alb_target_group specifies target group settings:

    • name: Target group name.
    • target: Target resource settings:
      • subnet_id: ID of the subnet hosting the VM. You can get the list of available subnets using the yc vpc subnet list CLI command.
      • ip_address: VM internal IP address. You can get the list of internal IP addresses using the following CLI command: yc vpc subnet list-used-addresses --id <subnet_ID>.

    You can also create a target group with resources outside Yandex Virtual Private Cloud, e.g., in your data center connected to Yandex Cloud via Yandex Cloud Interconnect:

    resource "yandex_alb_target_group" "foo" {
      name                   = "<target_group_name>"
    
      target {
        private_ipv4_address = true
        ip_address           = "<resource_1_IPv4_private_address>"
      }
    
      target {
        private_ipv4_address = true
        ip_address           = "<resource_2_IPv4_private_address>"
      }
    
      target {
        private_ipv4_address = true
        ip_address           = "<resource_3_IPv4_private_address>"
      }
    }
    

    Where yandex_alb_target_group specifies target group settings:

    • name: Target group name.
    • target: Target resource settings:
      • private_ipv4_address: Setting indicating that the IP address is outside Virtual Private Cloud.
      • ip_address: Resource’s private IPv4 address. This IP address must belong to the RFC 1918 private address range. For more information, see the subnets article.

    For more information about yandex_alb_target_group properties, see the relevant Terraform article.

  2. Create the resources:

    1. In the terminal, change to the folder where you edited the configuration file.

    2. Make sure the configuration file is correct using the command:

      terraform validate
      

      If the configuration is correct, the following message is returned:

      Success! The configuration is valid.
      
    3. Run the command:

      terraform plan
      

      The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.

    4. Apply the configuration changes:

      terraform apply
      
    5. Confirm the changes: type yes in the terminal and press Enter.

    Terraform will create all the required resources. You can check the new resources in the management console or using this CLI command:

    yc alb target-group list
    

Use the create REST API method for the TargetGroup resource or the TargetGroupService/Create gRPC API call.

See also

  • Fault-tolerant website with load balancing via Yandex Application Load Balancer
  • Writing load balancer logs to PostgreSQL
  • Creating an L7 load balancer with DDoS protection using the management console or CLI

Was the article helpful?

Previous
Creating Application Load Balancer infrastructure through a wizard
Next
Getting information about a target group
Yandex project
© 2025 Yandex.Cloud LLC