Information about current network load balancers
You can request detailed information about each network load balancer you created.
Getting a list of network load balancers in a folder
In the management console
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To get a list of network load balancers in the default folder, run this command:
yc load-balancer network-load-balancer list
Result:
+----------------------+-----------------------+-------------+----------+----------------+------------------------+--------+
| ID | NAME | REGION ID | TYPE | LISTENER COUNT | ATTACHED TARGET GROUPS | STATUS |
+----------------------+-----------------------+-------------+----------+----------------+------------------------+--------+
| enp9svq2ajbs******** | network-load-balancer | ru-central1 | EXTERNAL | 1 | enp1d7t5pdea******** | ACTIVE |
| ... | | | | | | |
+----------------------+-----------------------+-------------+----------+----------------+------------------------+--------+
Use the list API method, providing the folder ID in the folderId parameter of your request.
Getting detailed information about a network load balancer
- In the management console
, go to the folder housing the network load balancer. - Select Network Load Balancer.
- Click the name of the load balancer in question.
- The Overview page shows the load balancer details.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To find out the name or unique ID of a network load balancer, get a list of load balancers in the folder.
-
View the description of the CLI command to get information about a network load balancer:
yc load-balancer network-load-balancer --help -
To get your load balancer details, run this command with its name or ID specified:
yc load-balancer network-load-balancer get <load_balancer_name_or_ID>
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To get information about a network load balancer with the help of Terraform:
-
Add the
dataandoutputsections to the Terraform configuration file:data "yandex_lb_network_load_balancer" "my_balancer" { network_load_balancer_id = "<load_balancer_ID>" } output "network_load_balancer" { value = data.yandex_lb_network_load_balancer.my_balancer.created_at }Where:
data "yandex_lb_network_load_balancer": Description of the load balancer as a data source.network_load_balancer_id: Load balancer ID.
output "network_load_balancer": Output variable containing information about the load balancer creation date:value: Return value.
You can replace
created_atwith any other parameter to get the information you need. For more information about theyandex_lb_network_load_balancerdata source properties, see this Terraform provider article. -
Create the resources:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will create the required resources and display their output variables. To check the results, run this command:
terraform outputResult:
network_load_balancer = "2024-03-20T23:43:56Z" -
Use the get API method, providing the network load balancer ID in the networkLoadBalancerId parameter of your request.
You can get the network load balancer ID with the list of network load balancers in the folder.