Deleting an HTTP router
Warning
You cannot delete an HTTP router used in a load balancer. First, you need to remove it from all load balancers.
To delete an HTTP router:
-
In the management console
, select the folder with your HTTP router. -
Select Application Load Balancer.
-
Select your router and click
. -
In the menu that opens, select Delete.
To delete multiple routers at once, select them in 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 CLI 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 an HTTP router:
yc alb http-router delete --help
-
Run this command with your HTTP router name specified:
yc alb http-router delete --name <HTTP_router_name>
To check whether your router has been deleted, get a list of HTTP routers by running the command:
yc alb http-router list
If you do not have Terraform yet, install it and configure its Yandex Cloud provider.
To delete an HTTP router or virtual host created with Terraform:
-
Open the Terraform configuration file and delete the fragment describing the HTTP router or virtual host, i.e.,
yandex_alb_http_router
oryandex_alb_virtual_host
resource, 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, navigate 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
You will see a detailed list of resources. No changes will be made at this step. If your configuration contains errors, Terraform will show them.
-
Apply the changes:
terraform apply
-
Type
yes
and press Enter to confirm changes.You can check updates in the management console
or using 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.