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
Go to Network Load Balancer.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
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. - Go to 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 yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
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, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration 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.