Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
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 service resource operations
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • L7 load balancer logs
  • Release notes

In this article:

  • Add a VM to a target group
  • Remove a VM from a target group
  1. Step-by-step guides
  2. Target groups
  3. Editing a target group

Editing a target group

Written by
Yandex Cloud
Updated at November 11, 2025
  • Add a VM to a target group
  • Remove a VM from a target group

You can add or remove VMs from a target group.

Add a VM to a target groupAdd a VM to a target group

To add a VM to a target group:

Management console
CLI
Terraform
API
  1. In the management console, select your target group folder.
  2. Select Application Load Balancer.
  3. In the left-hand panel, select Target groups.
  4. Click your target group name.
  5. Click Add targets.
  6. Select a VM from the list or add the target manually:
    1. In the IP address field, specify the target's IP address 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 Subnets.

    3. Click Add target resource.

  7. Click Add.

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

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for adding resources to target groups:

    yc alb target-group add-targets --help
    
  2. Run this command, with your target group name, the subnet name, and the VM’s internal IP address specified:

    yc alb target-group add-targets \
      --name <target_group_name> \
      --target subnet-name=<subnet_name>,ip-address=<VM_internal_IP_address>
    

    Result:

    done (1s)
    id: a5d751meibht********
    name: <target_group_name>
    targets:
    ...
      - ip_address: <VM_internal_IP_address>
        subnet_id: fo2tgfikh3he********
    created_at: "2021-02-11T11:16:27.770674538Z"
    

    When editing a target group, you can add targets outside the Yandex Virtual Private Cloud, e.g., residing 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 Subnets.

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

    yc alb target-group add-targets \
      --name <target_group_name> \
      --target private-ip-address=true,ip-address=<private_IPv4_address_of_the_resource>
    

    Result:

    done (1s)
    id: a5d751meibht4ev26...
    name: <target_group_name>
    targets:
    ...
      - ip_address: <private_IPv4_address_of_the_resource>
        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 relevant documentation on the Terraform website or its mirror.

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

  1. Open the Terraform configuration file and add the target section to your target group description:

    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>"
      }
    
      target {
        subnet_id    = "<subnet_ID>"
        ip_address   = "<VM_4_internal_IP_address>"
      }
    }
    

    Where yandex_alb_target_group specifies target group settings:

    • name: Target group name.
    • target: Target 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>.

    When editing a target group, you can add targets outside the Yandex Virtual Private Cloud, e.g., residing 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 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 Subnets.

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

  2. Apply the changes:

    1. In the terminal, go to the directory where you edited the configuration file.

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

      terraform validate
      

      If the configuration is correct, you will get this message:

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

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

    You can check target group updates in the management console or using this CLI command:

    yc alb target-group get --name <target_group_name>
    

    Timeouts

    The Terraform provider limits operations with Application Load Balancer target groups to 10 minutes.

    Operations in excess of this time will be interrupted.

    How do I modify these limits?

    Add the timeouts section to the target group description, e.g.:

    resource "yandex_alb_target_group" "<target_group_name>" {
      ...
      timeouts {
        create = "60m"
        update = "60m"
        delete = "60m"
      }
    }
    

Use the addTargets REST API method for the TargetGroup resource or the TargetGroupService/AddTargets gRPC API call.

Remove a VM from a target groupRemove a VM from a target group

To remove a VM from a target group:

Management console
CLI
Terraform
API
  1. In the management console, select the folder with your target group.
  2. Select Application Load Balancer.
  3. In the left-hand panel, select Target groups.
  4. Click the name of the target group in question.
  5. Click next to the VM you need, then select Delete.
  6. In the window that opens, click Delete.

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

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for removing targets from a target group:

    yc alb target-group remove-targets --help
    
  2. Run this command with your target group name, the subnet name, and the VM’s internal IP address specified:

    yc alb target-group remove-targets \
      --name <target_group_name> \
      --target subnet-name=<subnet_name>,ip-address=<VM_internal_IP_address>
    

    Result:

    id: ds7urm6dn6cm********
    name: <target_group_name>
    folder_id: aoerb349v3h4********
    created_at: "2023-06-10T13:14:55.239094324Z"
    

    To remove a target group resource residing outside Virtual Private Cloud, e.g., in your data center connected to Yandex Cloud via Cloud Interconnect, run this command, with the target group name and the resource’s private IPv4 address specified:

    yc alb target-group remove-targets \
      --name <target_group_name> \
      --target private-ip-address=true,ip-address=<private_IPv4_address_of_the_resource>
    

    Result:

    id: ds7urm6dn6cm********
    name: <target_group_name>
    folder_id: aoerb349v3h4********
    created_at: "2023-06-10T13:14:55.239094324Z"
    

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 relevant documentation on the Terraform website or its mirror.

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

  1. Open the Terraform configuration file and delete the target section with your VM’s IP address from the target group description:

    Sample target group description in the Terraform configuration:

    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>"
      }
    }
    

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

  2. Apply the changes:

    1. In the terminal, go to the directory where you edited the configuration file.

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

      terraform validate
      

      If the configuration is correct, you will get this message:

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

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

    You can check target group updates in the management console or using this CLI command:

    yc alb target-group get --name <target_group_name>
    

Use the removeTargets REST API method for the TargetGroup resource or the TargetGroup/RemoveTargets gRPC API call.

Was the article helpful?

Previous
Getting information about a target group
Next
Deleting a target group
© 2025 Direct Cursus Technology L.L.C.