[Yandex Cloud documentation](../../../index.md) > [Yandex Application Load Balancer](../../index.md) > [Step-by-step guides](../index.md) > L7 load balancers > Availability zone management > Allowing and denying availability zone shutdown

# Allowing and denying availability zone shutdown


If an [availability zone](../../../overview/concepts/geo-scope.md) is under maintenance or shows signs of failure, Yandex Cloud technicians may temporarily shut down that zone. In which case the load balancer will automatically redistribute traffic among the remaining zones. As soon as the zone is back on track, it gets re-enabled, and uniform traffic distribution is resumed.

You can allow or deny auto-disabling an availability zone. However, you cannot select a particular zone to disable. Before allowing the automatic mode, you can try [disabling different availability zones](start-and-cancel-shift.md).

By default, availability zone shutdown is not allowed.

## Allowing availability zone shutdown {#allow}

{% 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.

  When [creating](../application-load-balancer-create.md) or [updating](../application-load-balancer-update.md) an L7 load balancer, specify the `--allow-zonal-shift` parameter, e.g.:

  ```bash
  yc application-load-balancer load-balancer update \
    <load_balancer_name_or_ID> \
    --allow-zonal-shift
  ```

  Result:

  ```text
  id: ds70q425egoe********
  name: my-balancer
  ...
  allow_zonal_shift: true
  ```

- Terraform {#tf}

  With [Terraform](https://www.terraform.io/), 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](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
  
  For more information about the provider resources, see the guides on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../../terraform/index.md).

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  1. In the configuration file, specify the `allow_zonal_shift` parameter set to `true` in the `yandex_alb_load_balancer` resource description:

      ```hcl
      resource "yandex_alb_load_balancer" "my-balancer" {
        ...
        allow_zonal_shift = true
        ...
      }
      ```

  1. Apply the changes:

      1. In the terminal, navigate to the configuration file directory.
      1. Make sure the configuration is correct using this command:
      
         ```bash
         terraform validate
         ```
      
         If the configuration is valid, you will get this message:
      
         ```bash
         Success! The configuration is valid.
         ```
      
      1. Run this command:
      
         ```bash
         terraform plan
         ```
      
         You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
      1. Apply the configuration changes:
      
         ```bash
         terraform apply
         ```
      
      1. Type `yes` and press **Enter** to confirm the changes.

      Terraform will change all required resources. You can check the resources for updates in the [management console](https://console.yandex.cloud).

      {% note warning "Timeouts" %}
      
      The Terraform provider limits operations with Application Load Balancer load balancers to 10 minutes.
      
      Operations in excess of this time will be interrupted.
      
      {% cut "How do I modify these limits?" %}
      
      Add the `timeouts` section to the load balancer description, e.g.:
      
      ```hcl
      resource "yandex_alb_load_balancer" "<load_balancer_name>" {
        ...
        timeouts {
          create = "60m"
          update = "60m"
          delete = "60m"
        }
      }
      ```
      
      {% endcut %}
      
      {% endnote %}

  For more information about `yandex_alb_load_balancer` properties, see [this provider guide](../../../terraform/data-sources/alb_load_balancer.md).

- API {#api}

  To allow zonal shift when creating an L7 load balancer, use the [create](../../api-ref/LoadBalancer/create.md) REST API method for the [LoadBalancer](../../api-ref/LoadBalancer/index.md) resource and set `"allowZonalShift": "true"`, or use the [LoadBalancerService/Create](../../api-ref/grpc/LoadBalancer/create.md) gRPC API call and set `"allow_zonal_shift": "true"`.

  To allow zonal shift when updating an L7 load balancer, use the [update](../../api-ref/LoadBalancer/update.md) REST API method for the [LoadBalancer](../../api-ref/LoadBalancer/index.md) resource and specify `"allowZonalShift": "true"`, or use the [LoadBalancerService/Update](../../api-ref/grpc/LoadBalancer/update.md) gRPC API call with `"allow_zonal_shift": "true"`.

{% endlist %}


## Denying availability zone shutdown {#deny}

{% 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.

  When creating or updating an L7 load balancer, specify the `--allow-zonal-shift=false` parameter, e.g.:

  ```bash
  yc application-load-balancer load-balancer update \
    <load_balancer_name_or_ID> \
    --allow-zonal-shift=false
  ```

  Result:

  ```text
  id: ds70q425egoe********
  name: my-balancer
  ...
  ```

- Terraform {#tf}

  With [Terraform](https://www.terraform.io/), 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](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
  
  For more information about the provider resources, see the guides on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../../terraform/index.md).

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  1. In the configuration file, specify the `allow_zonal_shift` parameter set to `false` in the `yandex_alb_load_balancer` resource description:

      ```hcl
      resource "yandex_alb_load_balancer" "my-balancer" {
        ...
        allow_zonal_shift = false
        ...
      }
      ```

  1. Apply the changes:

      1. In the terminal, navigate to the configuration file directory.
      1. Make sure the configuration is correct using this command:
      
         ```bash
         terraform validate
         ```
      
         If the configuration is valid, you will get this message:
      
         ```bash
         Success! The configuration is valid.
         ```
      
      1. Run this command:
      
         ```bash
         terraform plan
         ```
      
         You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
      1. Apply the configuration changes:
      
         ```bash
         terraform apply
         ```
      
      1. Type `yes` and press **Enter** to confirm the changes.

      Terraform will change all required resources. You can check the resources for updates in the [management console](https://console.yandex.cloud).

      {% note warning "Timeouts" %}
      
      The Terraform provider limits operations with Application Load Balancer load balancers to 10 minutes.
      
      Operations in excess of this time will be interrupted.
      
      {% cut "How do I modify these limits?" %}
      
      Add the `timeouts` section to the load balancer description, e.g.:
      
      ```hcl
      resource "yandex_alb_load_balancer" "<load_balancer_name>" {
        ...
        timeouts {
          create = "60m"
          update = "60m"
          delete = "60m"
        }
      }
      ```
      
      {% endcut %}
      
      {% endnote %}

  For more information about `yandex_alb_load_balancer` properties, see [this provider guide](../../../terraform/data-sources/alb_load_balancer.md).

- API {#api}

  To deny zonal shift when creating an L7 load balancer, use the [create](../../api-ref/LoadBalancer/create.md) REST API method for the [LoadBalancer](../../api-ref/LoadBalancer/index.md) resource and set `"allowZonalShift": "false"`, or use the [LoadBalancerService/Create](../../api-ref/grpc/LoadBalancer/create.md) gRPC API call and set `"allow_zonal_shift": "false"`.

  To deny zonal shift when updating an L7 load balancer, use the [update](../../api-ref/LoadBalancer/update.md) REST API method for the [LoadBalancer](../../api-ref/LoadBalancer/index.md) resource and specify `"allowZonalShift": "false"`, or use the [LoadBalancerService/Update](../../api-ref/grpc/LoadBalancer/update.md) gRPC API call with `"allow_zonal_shift": "false"`.

{% endlist %}


#### What's next {whats-next}

* [Enabling and disabling a zonal shift](start-and-cancel-shift.md)