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
    • AI Studio
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Application Load Balancer
  • Getting started
    • All guides
    • Creating Application Load Balancer infrastructure through a wizard
      • Creating an L7 load balancer
      • Editing an L7 load balancer
      • Getting information about an L7 load balancer
      • Viewing L7 load balancer statistics
      • Viewing L7 load balancer logs
      • Setting up L7 load balancer logging
      • Getting a log group ID of an L7 load balancer
      • Stopping and starting an L7 load balancer
      • Moving a VM to a target group in a different availability zone
      • Deleting an L7 load balancer
    • Viewing service resource operations
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • L7 load balancer logs
  • Release notes
  1. Step-by-step guides
  2. L7 load balancers
  3. Moving a VM to a target group in a different availability zone

Moving a VM to a target group in a new availability zone

Written by
Yandex Cloud
Updated at June 9, 2025

To move an L7 load balancer backend VM to a target group in a new availability zone:

  1. Enable load balancer traffic in the new availability zone:

    Management console
    CLI
    Terraform
    API
    1. In the management console, select the folder with your load balancer.
    2. Select Application Load Balancer.
    3. Click next to the load balancer you need, then select Edit.
    4. In the window that opens, under Allocation, enable traffic in the availability zone where you plan to move your VM.
    5. Click Save.

    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 enabling load balancer traffic:

      yc application-load-balancer load-balancer enable-traffic --help
      
    2. Get a list of all L7 load balancers in the default folder:

      yc application-load-balancer load-balancer list
      

      Result:

      +----------------------+-----------------------+-------------+----------------+---------+
      |          ID          |         NAME          |  REGION ID  | LISTENER COUNT | STATUS  |
      +----------------------+-----------------------+-------------+----------------+---------+
      | ds732hi8pn9n******** |      sample-alb1      | ru-central1 |              1 |  ACTIVE |
      | f3da23i86n2v******** |      sample-alb2      | ru-central1 |              1 |  ACTIVE |
      +----------------------+-----------------------+-------------+----------------+---------+
      
    3. Enable traffic in the new availability zone:

      yc application-load-balancer load-balancer enable-traffic <load_balancer_name> \
        --zone <availability_zone>
      

      Where --zone is the availability zone where you plan to move your VMs.

      Result:

      id: ds7pmslal3km********
      name: sample-alb1
      folder_id: b1gmit33ngp3********
      status: ACTIVE
      region_id: ru-central1
      network_id: enpn46stivv8********
      allocation_policy:
        locations:
          - zone_id: ru-central1-a
            subnet_id: e9bavnqlbiuk********
            disable_traffic: true
          - zone_id: ru-central1-b
              subnet_id: e2lgp8o00g06********
          - zone_id: ru-central1-d
              subnet_id: b0cv501fvp13********
      log_group_id: ckgah4eo2j0r********
      security_group_ids:
        - enpdjc5bitmj********
      created_at: "2023-08-09T08:34:24.887765763Z"
      log_options: {}
      

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

    1. Open the Terraform L7 load balancer configuration file and, under allocation_policy, specify the new availability zone and the ID of the previously created subnet:

      ...
        allocation_policy {
          location {
            zone_id   = [
              "<previous_availability_zone>",
              "<new_availability_zone>"
            ]
            subnet_id = [
              "<subnet_ID_in_previous_availability_zone>",
              "<ID_of_subnet_in_new_availability_zone>"
            ]
          }
        }
      }
      ...
      

      Where:

      • zone_id: Availability zones where the load balancer will receive traffic.
      • subnet_id: IDs of the subnets in these availability zones.

      For more information about resource properties in Terraform, see the relevant provider documentation.

    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. Terraform will show any errors found in your configuration.

      4. Apply the changes:

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

      The load balancer will start receiving traffic in the new availability zone. You can check this in the management console or using this CLI command:

      yc alb load-balancer get <load_balancer_name>
      

    Use the update REST API method for the LoadBalancer resource or the LoadBalancerService/Update gRPC API call.

  2. Set up a security group for the load balancer if needed. For proper load balancer operation, its security groups must allow outbound connections to the subnet addresses in your VM’s new availability zone.

  3. Move your VM to the new availability zone.

  4. Add your VM to the load balancer target group and delete its old entry.

  5. Make sure the load balancer identifies your VM status as HEALTHY:

    Management console
    API
    1. In the management console, select the folder with your load balancer.
    2. Select Application Load Balancer.
    3. Select the load balancer you need.
    4. Navigate to the Health checks tab.
    5. Expand the list of targets. Make sure the target group VMs have the HEALTHY status.

    Use the getTargetStates REST API method for the LoadBalancer resource or the LoadBalancerService/GetTargetStates gRPC API call.

    The load balancer will not recognize a VM status as HEALTHY immediately after adding it to the target group. This may take a few minutes depending on your backend settings.

    If the load balancer consistently identifies your VM status as UNHEALTHY over an extended period, check its security group configuration.

Was the article helpful?

Previous
Stopping and starting an L7 load balancer
Next
Allowing and denying traffic transfer
© 2025 Direct Cursus Technology L.L.C.