Getting information about a route table
- In the management console
, select the folder containing your route table. - Select Virtual Private Cloud.
- In the left-hand panel, select
Routing tables. - Select the route table you need.
- The Overview page will display detailed information about the route table.
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.
-
View the description of the CLI command to get information about a route table:
yc vpc route-table get --help -
Get information about your route table by specifying its name or ID:
yc vpc route-table get <route_table_name>Result:
id: enpmgov0n4ah******** folder_id: b1go3el0d8fs******** created_at: "2023-09-20T13:56:58Z" name: my-routing network_id: enpols3n07b8******** static_routes: - destination_prefix: 0.0.0.0/0 gateway_id: enpkq1ujbgrs********
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 route table using Terraform:
-
Add the
dataandoutputsections to the Terraform configuration file:data "yandex_vpc_route_table" "my-rt" { route_table_id = "<route_table_ID>" } output "route-table" { value = data.yandex_vpc_route_table.my-rt.static_route }Where:
data "yandex_vpc_route_table": Description of the route table as a data source:route_table_id: Route table ID.
output "route-table": Output variable containing information about static routes of the route table:value: Returned value.
You can replace
static_routewith any other parameter to get the information you need. For more information about theyandex_vpc_route_tabledata source parameters, see the relevant provider documentation. -
Create 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 all the required resources and display the output variable values in the terminal. To check the results, run this command:
terraform outputResult:
route-table = toset([ { "destination_prefix" = "0.0.0.0/0" "gateway_id" = "enpkq1ujbgrs********" "next_hop_address" = "" }, ]) -
To get detailed information about a route table, use the get REST API method for the RouteTable resource or the RouteTableService/Get gRPC API call.