Deleting an HTTP router
Warning
If an HTTP router is used in at least one load balancer, you cannot delete it. First, you need to delete it from all load balancers.
To delete an HTTP router:
-
In the management console
, select the folder where the HTTP router was created. -
Select Application Load Balancer.
-
Select the router and click
. -
In the menu that opens, select Delete.
To do this with multiple HTTP routers, select the routers to delete from the list and click Delete at the bottom of the screen.
-
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.
-
View a description of the CLI command for deleting an HTTP router:
yc alb http-router delete --help
-
Run the command, specifying the name of the HTTP router:
yc alb http-router delete --name <HTTP_router_name>
To check the deletion, get a list of HTTP routers by running the command:
yc alb http-router list
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete an HTTP router or virtual host created with Terraform:
-
Open the Terraform configuration file and delete the fragment with the HTTP router or virtual host description (the
yandex_alb_http_router
andyandex_alb_virtual_host
resources, respectively).Sample HTTP router and virtual host description in the Terraform configuration
... resource "yandex_alb_http_router" "tf-router" { name = "my-http-router" labels = { tf-label = "tf-label-value" empty-label = "" } } resource "yandex_alb_virtual_host" "my-virtual-host" { name = "my-virtual-host" http_router_id = "${yandex_alb_http_router.tf-router.id}" route { name = "my-route" http_route { http_route_action { backend_group_id = "${yandex_alb_backend_group.backend-group.id}" timeout = "3s" } } } } ...
-
In the command line, go to the directory with the Terraform configuration file.
-
Check the configuration using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
The terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can check the update using the management console
or this CLI command:yc alb http-router list
Use the delete REST API method for the HttpRouter resource or the HttpRouter/Delete gRPC API call.