Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • 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
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Network Load Balancer
  • Getting started
    • All guides
      • Information about current network load balancers
      • Creating a load balancer
      • Creating an internal load balancer
      • Stopping and starting a load balancer
      • Configuring deletion protection
      • Changing load balancer settings
      • Moving a VM to a target group in a new availability zone
      • Deleting a load balancer
      • Checking target health statuses
      • Adding a listener
      • Deleting a listener
    • Viewing service resource operations
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • Enabling deletion protection
  • Disable deletion protection
  1. Step-by-step guides
  2. Network load balancers
  3. Configuring deletion protection

Configuring deletion protection

Written by
Yandex Cloud
Updated at December 25, 2025
  • Enabling deletion protection
  • Disable deletion protection

To prevent accidental deletion of a network load balancer, enable deletion protection for it.

You can disable protection when you no longer need it.

Enabling deletion protectionEnabling deletion protection

Warning

Even with balancer deletion protection enabled, one can still delete its listeners and target groups.

Management console
CLI
Terraform
API
  1. In the management console, select Network Load Balancer.
  2. To the right of your load balancer name, click and select Edit.
  3. Enable the Deletion protection setting.
  4. 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 updating balancer attributes:

    yc load-balancer network-load-balancer update --help
    
  2. Enable deletion protection:

    yc load-balancer network-load-balancer update <load_balancer_name_or_ID> \
        --deletion-protection
    

    You can get the load balancer ID and name with the list of network load balancers in the folder.

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 current configuration file describing the infrastructure.

  2. Add the deletion_protection parameter to the load balancer description:

    resource "yandex_lb_network_load_balancer" "foo" {
      ...
      deletion_protection = true
      ...
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Apply the changes.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

To enable deletion protection, use the update REST API method for the NetworkLoadBalancer resource or the NetworkLoadBalancerService/Update gRPC API call and provide the following in the request:

  • Name of the deletionProtection parameter in the updateMask parameter.
  • true in the deletionProtection parameter.

Warning

The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

Disable deletion protectionDisable deletion protection

Management console
CLI
Terraform
API
  1. In the management console, select Network Load Balancer.
  2. To the right of your load balancer name, click and select Edit.
  3. Disable the Deletion protection setting.
  4. 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 updating balancer attributes:

    yc load-balancer network-load-balancer update --help
    
  2. Disable deletion protection:

    yc load-balancer network-load-balancer update <load_balancer_name_or_ID> \
        --deletion-protection=false
    

    You can get the load balancer ID and name with the list of network load balancers in the folder.

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 current configuration file describing the infrastructure.

  2. In the load balancer description, change the deletion_protection value to false:

    resource "yandex_lb_network_load_balancer" "foo" {
      ...
      deletion_protection = false
      ...
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Apply the changes.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

To enable deletion protection, use the update REST API method for the NetworkLoadBalancer resource or the NetworkLoadBalancerService/Update gRPC API call and provide the following in the request:

  • Name of the deletionProtection parameter in the updateMask parameter.
  • false in the deletionProtection parameter.

Warning

The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

Was the article helpful?

Previous
Stopping and starting a load balancer
Next
Changing load balancer settings
© 2025 Direct Cursus Technology L.L.C.