DescribeRouteTables

更新时间:
复制 MD 格式

Calls the DescribeRouteTables operation to query route tables.

Note

This API has been deprecated. We recommend migrating to Vpc(2016-04-28) - DescribeRouteTableList for enhanced functionality and continued support. While the deprecated API remains temporarily accessible, no further updates or bug fixes will be provided.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vpc:DescribeRouteTables

list

*RouteTable

acs:vpc:{#regionId}:{#accountId}:routetable/{#RouteTableId}

  • vpc:VBR
  • vpc:VRouter
None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

No

The region ID of the VPC to which the route table belongs.

You can call the DescribeRegions operation to query the region ID.

ap-southeast-6

VRouterId

string

No

The ID of the vRouter to query.

Note

You must specify at least one of the following parameters: VRouterId, RouteTableId, RouterId, and RouteTableName. You cannot specify both VRouterId and RouterId at the same time.

vrt-bp1lhl0taikrteen****

RouteTableId

string

No

The ID of the route table to query.

Note

You must specify at least one of the following parameters: VRouterId, RouteTableId, RouterId, and RouteTableName. You cannot specify both VRouterId and RouterId at the same time.

vtb-bp145q7glnuzdvzu2****

RouterType

string

No

The type of the router to which the route table belongs. Valid values:

  • VRouter (default): vRouter.

  • VBR: Virtual Border Router.

VRouter

RouterId

string

No

The ID of the router to which the route table belongs.

Note

You must specify at least one of the following parameters: VRouterId, RouteTableId, RouterId, and RouteTableName. You cannot specify both VRouterId and RouterId at the same time.

vrt-bp1lhl0taikrteen8****

Type

string

No

The destination type of the route to query. Valid values:

  • Custom: custom route.

  • System: system route.

  • BGP: BGP route.

  • CEN: Cloud Enterprise Network (CEN) route.

  • ECR: Express Connect Router (ECR) route.

Custom

RouteTableName

string

No

The name of the route table to query.

The name must be 2 to 128 characters in length and must start with a letter or a Chinese character. It can contain digits, periods (.), underscores (_), and hyphens (-).

Note

You must specify at least one of the following parameters: VRouterId, RouteTableId, RouterId, and RouteTableName. You cannot specify both VRouterId and RouterId at the same time.

doctest

ResourceGroupId

string

No

The ID of the resource group to which the route table belongs.

rg-acfmxazb4ph****

PageNumber

integer

No

The page number. Default value: 1.

1

PageSize

integer

No

The number of entries per page during paging. Maximum value: 50. Default value: 10.

10

Response elements

Element

Type

Description

Example

object

The number of entries per page.

PageSize

integer

The number of entries per page.

10

RequestId

string

The request ID.

DC668356-BCB4-42FD-9BC3-FA2B2E04B634

PageNumber

integer

The current page number.

1

TotalCount

integer

The total number of entries returned.

1

RouteTables

object

RouteTable

array<object>

The details of the route tables.

array<object>

The time when the route table was created.

CreationTime

string

The time when the route table was created.

The time is displayed in the YYYY-MM-DDThh:mm:ssZ format in UTC.

2022-08-22T10:40:25Z

Status

string

The status of the route table. Valid values:

  • Pending

  • Available

Available

VRouterId

string

The vRouter ID.

vrt-bp1lhl0taikrteen****

RouteTableType

string

The type of the route table. Valid values:

  • Custom

  • System

Custom

ResourceGroupId

string

The ID of the resource group to which the route table belongs.

rg-acfmxazb4ph****

RouteTableId

string

The ID of the route table.

vtb-bp145q7glnuzdvzu2****

RouteEntrys

object

RouteEntry

array<object>

The information about the route.

array<object>

Type

string

The route type. Valid values:

  • Custom

  • System

  • BGP

  • CEN

Custom

Status

string

The route status. Valid values:

  • Pending

  • Available

  • Modifying

Available

NextHopType

string

The type of the next hop. Valid values:

  • Instance (default): an Elastic Compute Service (ECS) instance

  • HaVip: a high-availability virtual IP address (HaVip).

  • VpnGateway: a VPN gateway

  • NatGateway: a NAT gateway

  • NetworkInterface: a secondary elastic network interface (ENI)

  • RouterInterface: a router interface

  • IPv6Gateway: an IPv6 gateway

  • Attachment: a transit router

Instance

RouteEntryName

string

The route name.

The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-).

name

RouteEntryId

string

The ID of the route.

rte-bp1mnnr2al0naomnp****

InstanceId

string

The ID of the instance associated with the next hop.

vpc-bp1t36rn9l53iwbsf****

RouteTableId

string

The route table ID.

vtb-bp15w5q90d2rk3bww****

Description

string

The description of the route. The description must be 2 to 256 characters in length. It must start with a letter but cannot start with http:// or https://.

RouteEntryDescription

DestinationCidrBlock

string

The destination CIDR block of the route. The destination CIDR block supports IPv4 and IPv6. Make sure that the destination CIDR block meets the following requirements:

  • The destination CIDR block is not 100.64.0.0/10 or a subset of 100.64.0.0/10.

  • The destination CIDR block of each route in the route table is unique.

192.168.2.0/24

NextHops

object

NextHop

array<object>

The information about the next hop.

object

NextHopId

string

The ID of the next hop.

vpn-bp10zyaph5cc8b7c7****

Weight

integer

The weight of the route.

100

NextHopType

string

The type of the next hop. Valid values:

  • Instance: an ECS instance

  • HaVip: an HaVip

  • VpnGateway: a VPN gateway

  • NatGateway: a NAT gateway

  • NetworkInterface: a secondary ENI

  • RouterInterface: a router interface

  • IPv6Gateway: an IPv6 gateway

  • Attachment: a transit router

Instance

Enabled

integer

Indicates whether the route is available. Valid values:

  • 0: unavailable

  • 1: available

1

VSwitchIds

object

VSwitchId

array

The vSwitch ID.

string

The vSwitch ID.

vsw-bp12mw1f8k3jgygk9****

Examples

Success response

JSON format

{
  "PageSize": 10,
  "RequestId": "DC668356-BCB4-42FD-9BC3-FA2B2E04B634",
  "PageNumber": 1,
  "TotalCount": 1,
  "RouteTables": {
    "RouteTable": [
      {
        "CreationTime": "2022-08-22T10:40:25Z",
        "Status": "Available",
        "VRouterId": "vrt-bp1lhl0taikrteen****",
        "RouteTableType": "Custom",
        "ResourceGroupId": "rg-acfmxazb4ph****",
        "RouteTableId": "vtb-bp145q7glnuzdvzu2****",
        "RouteEntrys": {
          "RouteEntry": [
            {
              "Type": "Custom",
              "Status": "Available",
              "NextHopType": "Instance",
              "RouteEntryName": "name",
              "RouteEntryId": "rte-bp1mnnr2al0naomnp****",
              "InstanceId": "vpc-bp1t36rn9l53iwbsf****",
              "RouteTableId": "vtb-bp15w5q90d2rk3bww****",
              "Description": "RouteEntryDescription",
              "DestinationCidrBlock": "192.168.2.0/24",
              "NextHops": {
                "NextHop": [
                  {
                    "NextHopId": "vpn-bp10zyaph5cc8b7c7****",
                    "Weight": 100,
                    "NextHopType": "Instance",
                    "Enabled": 1
                  }
                ]
              }
            }
          ]
        },
        "VSwitchIds": {
          "VSwitchId": [
            "vsw-bp12mw1f8k3jgygk9****"
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidVRouterId.NotFound Specified virtual router does not exist.
400 OperationFailed.DescribeCenRoute An error occurred while querying the CEN route entry. CEN routes are abnormal.
400 OperationFailed.VRouterNotExist Operation failed because the VRouter does not exist. Operation failed because the VRouter does not exist.
400 IllegalParam.Type The parameter of Type is illegal. Illegal parameter Type.
400 OperationFailed.InvalidRouterType The operation is failed because of %s. Invalid router type.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.