Edit an L7 load balancer
To update the parameters of an L7 load balancer:
- In the management console, select the folder where the load balancer was created.
- Select Application Load Balancer.
- Click on the name of the load balancer you need.
- Click and select Edit.
- Edit the load balancer settings.
- Under Listeners, click next to the desired listener and select Edit.
- Edit the listener settings and click Save.
- At the bottom of the page, click Save.
If you don't 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 updating the load balancer parameters:
yc alb load-balancer update --help
-
Run the command, indicating the new load balancer parameters:
yc alb load-balancer update <load balancer name> --new-name <new load balancer name>
Result:
id: a5d88ep483cmbfm63g9t name: test-balancer2-updated folder_id: aoe197919j8elpeg1lkp status: ACTIVE region_id: ru-central1 network_id: c64l1c06d15178sa87k0 listeners: - name: test-listener endpoints: - addresses: - external_ipv4_address: address: 130.193.32.206 ports: - "80" http: handler: http_router_id: a5dv7tjdo9gt2pq5l906 allocation_policy: locations: - zone_id: ru-central1-a subnet_id: buc4gsmpj8hvramg61g8 - zone_id: ru-central1-b subnet_id: blt6pcatjje62sqvjq5b - zone_id: ru-central1-c subnet_id: fo2ap2nrhjk9vpfdnno8 log_group_id: eolul9ap0bv02i8bsp87 created_at: "2021-04-26T12:12:13.624832586Z"
-
Set new parameters for the listener:
-
HTTP listener:
-
View a description of the CLI command for updating the parameters of an HTTP listener for an L7 load balancer:
yc alb load-balancer update-listener --help
-
Run the command, indicating the new listener parameters:
yc alb load-balancer update-listener <load balancer name> \ --listener-name <listener name> \ --http-router-id <HTTP router ID> \ --external-ipv4-endpoint port=<listener port>
-
-
Stream listener:
-
View a description of the CLI command for updating the parameters of a Stream listener for an L7 load balancer:
yc alb load-balancer update-stream-listener --help
-
Run the command, indicating the new listener parameters:
yc alb load-balancer update-stream-listener <load balancer name> \ --listener-name=<listener name> \ --backend-group-id=<backend group ID> \ --external-ipv4-endpoint port=<listener port>
-
Result of updating two listeners:
done (42s) id: ds76g8b2op3fej12nab6 name: test-load-balancer folder_id: b1gu6g9ielh690at5bm7 status: ACTIVE network_id: enp0uulja5s3j1ftvfei listeners: - name: tslistener endpoints: - addresses: - external_ipv4_address: address: 51.250.64.197 ports: - "80" http: handler: http_router_id: ds7d7b14b3fsv7qjkvel - name: teststreamlistener endpoints: - addresses: - external_ipv4_address: address: 51.250.64.197 ports: - "443" stream: handler: backend_group_id: ds77tero4f5h46l4e2gl allocation_policy: locations: - zone_id: ru-central1-a subnet_id: e9bs1hp7lgdl1g3n6ci1 - zone_id: ru-central1-b subnet_id: e2le8i7hqa216f6i6php - zone_id: ru-central1-c subnet_id: b0cgk1au6fn203f3tqnf log_group_id: ckgs4u5km3u8j9f360md security_group_ids: - enp49ot04g63ih1scuap created_at: "2022-04-04T02:12:40.160629110Z"
-
For more information about Terraform, see the documentation.
-
Open the Terraform configuration file and edit the fragment with the L7 load balancer description:
... resource "yandex_alb_load_balancer" "test-balancer" { name = "my-load-balancer" network_id = yandex_vpc_network.test-network.id allocation_policy { location { zone_id = "ru-central1-a" subnet_id = yandex_vpc_subnet.test-subnet.id } } listener { name = "my-listener" endpoint { address { external_ipv4_address { } } ports = [ 9000 ] } http { handler { http_router_id = yandex_alb_http_router.test-router.id } } } } ...
For more information about the
yandex_alb_load_balancer
resource in Terraform, see the provider documentation. -
Check the configuration using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If there are errors in the configuration, Terraform points them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can verify the change to the L7 load balancer using the management console or the following CLI command:
yc alb load-balancer get <L7 load balancer name>
Deleting a listener
To delete a listener for your L7 load balancer:
- In the management console, select the folder where the load balancer was created.
- Select Application Load Balancer.
- Click next to the load balancer name and select Edit.
- Under Listeners, click next to the listener name and select Delete.
- Click Save.
If you don't 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 listener delete command:
yc alb load-balancer remove-listener --help
-
Run the command:
yc alb load-balancer remove-listener <load balancer ID or name> \ --listener-name=<listener name>
Result:
done (50s)
For more information about Terraform, see the documentation.
-
Open the Terraform configuration file and delete the
listener
section from the L7 load balancer description.... resource "yandex_alb_load_balancer" "test-balancer" { name = "my-load-balancer" network_id = yandex_vpc_network.test-network.id allocation_policy { location { zone_id = "ru-central1-a" subnet_id = yandex_vpc_subnet.test-subnet.id } } listener { name = "my-listener" endpoint { address { external_ipv4_address { } } ports = [ 9000 ] } http { handler { http_router_id = yandex_alb_http_router.test-router.id } } } } ...
For more information about the
yandex_alb_load_balancer
resource in Terraform, see the provider documentation. -
Check the configuration using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If there are errors in the configuration, Terraform points them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can verify the change to the L7 load balancer using the management console or the following CLI command:
yc alb load-balancer get <L7 load balancer name>