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
Route table. - 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 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 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********
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To get information about a route table using Terraform:
-
Add the
data
andoutput
sections 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 that contains information about static routes of the route table:value
: Returned value.
You can replace
static_route
with any other parameter to get the information you need. For more information about theyandex_vpc_route_table
data source parameters, see the provider documentation . -
Create resources:
-
In the terminal, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct 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 the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
Terraform will create the required resources and display the output variable values in the terminal. To check the results, run:
terraform output
Result:
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.