Deleting a network load balancer
- In the management console
, select the folder where you need to delete a load balancer. - In the list of services, select Network Load Balancer.
- Next to the load balancer you need to delete, click
and select Delete. - In the window that opens, click Delete.
If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.
The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID>
command. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
See the description of the CLI command for deleting a network load balancer:
yc load-balancer network-load-balancer delete --help
-
Delete the load balancer:
yc load-balancer network-load-balancer delete <load_balancer_name_or_ID>
You can get the load balancer ID and name with the list of network load balancers in the folder.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the documentation on the Terraform
If you do not have Terraform yet, install it and configure its Yandex Cloud provider.
To delete a network load balancer created with Terraform:
-
Open the Terraform configuration file and delete the section describing the network load balancer.
... resource "yandex_lb_network_load_balancer" "foo" { name = "<load_balancer_name>" listener { name = "<listener_name>" port = <port_number> external_address_spec { ip_version = "<IP_address_version>" } } attached_target_group { target_group_id = "<target_group_ID>" healthcheck { name = "<health_check_name>" http_options { port = <port_number> path = "<URL>" } } } } ...
-
Make sure the settings are correct.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validate
Terraform will show any errors found in your configuration files.
-
-
Delete the network load balancer.
-
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.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply
-
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
To delete a network load balancer, use the delete REST API method for the NetworkLoadBalancer resource or the NetworkLoadBalancerService/Delete gRPC API call.
Examples
Deleting a network load balancer from a particular folder ({from-folder})
To delete a network load balancer from another folder, use the --folder-id
or --folder-name
parameters:
yc load-balancer network-load-balancer delete test-load-balancer \
--folder-id=b1gnbfd11bq5********
yc load-balancer network-load-balancer delete test-load-balancer \
--folder-name=test-folder