[Yandex Cloud documentation](../../../index.md) > [Yandex Network Load Balancer](../../index.md) > [Step-by-step guides](../index.md) > Network load balancers > Managing availability zones > Enabling and disabling availability zones

# Enabling and disabling availability zones

If an [availability zone](../../../overview/concepts/geo-scope.md) is under testing or maintenance or has technical problems, you can block traffic distribution to that zone. This will ensure your services stay operational. When appropriate, you can run a command to resume traffic to the blocked zone or it will be restored automatically by timeout.

You can enable and disable availability zones one by one or as a comma-separated list.


## Disabling availability zones {#disable-zone}

{% note warning %}

If you are using a network or an L7 load balancer in combination with an instance group [with autoscaling](../../../compute/concepts/instance-groups/scale.md#auto-scale), before disabling a zone in the load balancer, first, [disable](../../../compute/operations/instance-groups/disable-enable-zone.md#disable) this zone for the instance group. Otherwise, the instance group will continue creating instances in a zone which does not receive traffic.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the relevant folder.
  1. Navigate to **Network Load Balancer**.
  1. Select the network load balancer in question.
  1. Under **Allocation**, click **Manage zone lock**.
  1. Enable **Block** next to the availability zones you want to disable.
  1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the availability zone disable command for a network load balancer:

        ```bash
        yc load-balancer network-load-balancer disable-zones --help
        ```

  1. Get a list of all network load balancers in the default folder:

        ```bash
        yc load-balancer network-load-balancer list
        ```

        Result:

        ```text
      +----------------------+-------------+-------------+----------+----------------+------------------------+--------+
      |          ID          |     NAME    |  REGION ID  |   TYPE   | LISTENER COUNT | ATTACHED TARGET GROUPS | STATUS |
      +----------------------+-------------+-------------+----------+----------------+------------------------+--------+
      | ds70q425egoe******** | my-balancer | ru-central1 | EXTERNAL |              1 | enpakget56sr********   | ACTIVE |
      |                      |             |             |          |                | enpakf7vhj2l********   |        |
      | fw7fh46bnsge******** | my-nlb2     | ru-central1 | EXTERNAL |              1 | sn5u68knmswe********   | ACTIVE |
      +----------------------+-------------+-------------+----------+----------------+------------------------+--------+
      ```

  1. Disable one or more availability zones using the following command:

      ```bash
      yc load-balancer network-load-balancer disable-zones \
        <load_balancer_name_or_ID> \
        --zones=<zone_1_ID>,[<zone_2_ID>] \
        --duration=<duration>
      ```

      Where:
      
      * `--zones`: Availability zone IDs.
      * `--duration`: Duration, from `1m` to `72h`. No value stands for unlimited duration. If zones are provided as a list, they all will be disabled for the specified period.

  {% note info %}
  
  You cannot run the zone disable command more often than once every two minutes.
  
  {% endnote %}

{% endlist %}

### Examples {#examples}

#### Disabling two availability zones {#two-zones-off}

{% list tabs group=instructions %}

- CLI {#cli}

  To disable two zones for a load balancer, list them separated by commas:

  ```bash
  yc load-balancer network-load-balancer disable-zones ds70q425egoe******** \
    --zones=ru-central1-b,ru-central1-d
  ```

  Result:

  ```text
  id: ds70q425egoe********
  ...
  disable_zone_statuses:
    - zone_id: ru-central1-b
    - zone_id: ru-central1-d
  ```

{% endlist %}

#### Disabling an availability zone for 30 minutes {#zone-off-30min}

{% list tabs group=instructions %}

- CLI {#cli}

  To disable a single availability zone for 30 minutes, use the `--duration` parameter:

  ```bash
  yc load-balancer network-load-balancer disable-zones ds70q425egoe******** \
    --zones=ru-central1-b \
    --duration=30m
  ```

  Result:

  ```text
  id: ds70q425egoe********
  ...
  disable_zone_statuses:
    - zone_id: ru-central1-b
      disabled_until: "2025-06-06T04:10:02.679608678Z"
  ```

  You can extend the zone lock by running the above command with the `--duration` parameter once again for the same zone.

{% endlist %}


## Enabling availability zones {#enable-zone}

{% note warning %}

If you are using a network or an L7 load balancer in combination with an instance group [with autoscaling](../../../compute/concepts/instance-groups/scale.md#auto-scale), before enabling a zone in the load balancer, first, [enable](../../../compute/operations/instance-groups/disable-enable-zone.md#enable) this zone for the instance group to distribute its instances across the zones.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the relevant folder.
  1. Navigate to **Network Load Balancer**.
  1. Select the network load balancer in question.
  1. Under **Allocation**, click **Manage zone lock**.
  1. Disable **Block** next to the availability zones you want to enable.
  1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the availability zone enable command for a network load balancer:

      ```bash
      yc load-balancer network-load-balancer enable-zones --help
      ```

  1. Get a list of all network load balancers in the default folder:

      ```bash
      yc load-balancer network-load-balancer list
      ```

      Result:

      ```text
      +----------------------+-------------+-------------+----------+----------------+------------------------+--------+
      |          ID          |     NAME    |  REGION ID  |   TYPE   | LISTENER COUNT | ATTACHED TARGET GROUPS | STATUS |
      +----------------------+-------------+-------------+----------+----------------+------------------------+--------+
      | ds70q425egoe******** | my-balancer | ru-central1 | EXTERNAL |              1 | enpakget56sr********   | ACTIVE |
      |                      |             |             |          |                | enpakf7vhj2l********   |        |
      | fw7fh46bnsge******** | my-nlb2     | ru-central1 | EXTERNAL |              1 | sn5u68knmswe********   | ACTIVE |
      +----------------------+-------------+-------------+----------+----------------+------------------------+--------+
      ```

  1. Enable one or more availability zones:

      ```bash
      yc load-balancer network-load-balancer enable-zones \
        <load_balancer_name_or_ID> \
        --zones=<zone_1_ID>,[<zone_2_ID>]
      ```

     Result:

      ```text
      id: ds70q425egoe********
      ...
      allow_zonal_shift: false
      disable_zone_statuses:
      ```

{% endlist %}


## Check availability zone lock settings {#check-shift}

{% list tabs group=instructions %}

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To check if there are any disabled zones and whether a lock period is set, run the following command:

    ```bash
    yc load-balancer network-load-balancer get \
      <load_balancer_name_or_ID>
    ```

    Result:

    ```text
    id: ds70q425egoe********
    ...
    disable_zone_statuses:
      - zone_id: ru-central1-b
      - zone_id: ru-central1-d
        disabled_until: "2025-06-06T04:10:02.679608678Z"
    ```
      
{% endlist %}

### Useful links {#see-also}

* [Disabling and enabling availability zones for a Yandex Compute Cloud instance group](../../../compute/operations/instance-groups/disable-enable-zone.md)
* [Disabling and enabling availability zones in Yandex Application Load Balancer](../../../application-load-balancer/operations/manage-zone/start-and-cancel-shift.md)