Deleting a network load balancer
- In the management console
, select the folder to delete a load balancer from. - In the list of services, select Network Load Balancer.
- In the line of the load balancer to delete, click
and select Delete. - In the window that opens, click Delete.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
See the description of the CLI's delete network load balancer command:
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 a list of network load balancers in the folder.
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete a network load balancer created with Terraform:
-
Open the Terraform configuration file and delete the fragment with the network load balancer description.
... resource "yandex_lb_network_load_balancer" "foo" { name = "<load_balancer_name>" listener { name = "<listener_name>" port = <port_number> external_address_spec { ip_version = "<IP_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.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Delete the network load balancer.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of 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 specific 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