All Products
Search
Document Center

Virtual Private Cloud:AssociateRouteTableWithGateway

Last Updated:Jul 16, 2026

Calls the AssociateRouteTableWithGateway operation to associate a gateway route table with an IPv4 gateway or IPv6 gateway instance in the same VPC.

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:AssociateRouteTableWithGateway

create

*Ipv4Gateway

acs:vpc:{#regionId}:{#accountId}:ipv4gateway/{#ipv4gatewayId}

*RouteTable

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

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the gateway route table and IPv4 gateway instance to associate.

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

ap-southeast-6

RouteTableId

string

Yes

The ID of the gateway route table to associate.

vtb-5ts0ohchwkp3dydt2****

ClientToken

string

No

The client token that is used to ensure the idempotence of the request.

The client generates the value. The value must be unique among different requests and cannot exceed 64 ASCII characters in length.

Note

If you do not specify this parameter, the system uses the RequestId of the API request as the ClientToken. The RequestId may differ for each API request.

123e4567-e89b-12d3-a456-426655440000

DryRun

boolean

No

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run without associating the gateway route table with the IPv4 gateway instance. The system checks the required parameters, request format, and service limits. If the check fails, the corresponding error is returned. If the check succeeds, the error code DryRunOperation is returned.

  • false (default): performs a dry run and sends the request. If the check succeeds, an HTTP 2xx status code is returned and the gateway route table is associated with the IPv4 gateway instance.

false

GatewayId

string

Yes

The instance ID of the IPv4 gateway to associate.

The IPv4 gateway instance to associate must be in the Activated state.

ipv4gw-5tsnc6s4ogsedtp3k****

GatewayType

string

No

The type of the gateway instance to associate.

Ipv4Gateway

RegionId

string

Yes

The region ID of the IPv4 gateway with which you want to associate the gateway route table.

You can call the DescribeRegions operation to query the most recent region list.

ap-southeast-6

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

F89C2176-8F10-55EF-90CF-CF99D1E3F816

Examples

Success response

JSON format

{
  "RequestId": "F89C2176-8F10-55EF-90CF-CF99D1E3F816"
}

Error codes

HTTP status code

Error code

Error message

Description

400 ResourceNotFound.Ipv4Gateway The specified resource ipv4Gateway is not found. The IPv4 gateway is not found and cannot be deleted.
400 IncorrectStatus.Ipv4Gateway The status of %s [%s] is incorrect. The IPv4 gateway is in an invalid state. Try again later.
400 ResourceAlreadyAssociated.Ipv4Gateway The specified resource %s is already associated. The IPv4 gateway is already associated.
400 ResourceNotFound.GatewayRouteTable The specified resource GatewayRouteTable is not found. The gateway route table cannot be found.
400 IncorrectStatus.GatewayRouteTable The status of %s [%s] is incorrect. The gateway route table is in an invalid state. Try again later.
400 ResourceAlreadyAssociated.GatewayRouteTable The specified resource %s is already associated. The gateway route table is already associated with a gateway of the same type.
400 OperationDenied.Ipv4GatewayNotActive The operation is not allowed because of ipv4Gateway [%s] is not active. The operation is not allowed because the IPv4 gateway is not activated.
400 OperationDenied.RouteTableTypeIncorrect The operation is not allowed because of routeTableType is incorrect. The operation is not allowed because the type of route table is not supported.
400 ResourceNotFound.RouteTable The specified resource gatewayRouteTable is not found. The gateway route table does not exist.
400 OperationDenied.GatewayAndTableNotInOneVpc The operation is not allowed because of GatewayAndTableNotInOneVpc. The gateway route table and gateway do not belong to the same VPC.
400 IncorrectStatus.RouteTable The status of the specified route table is incorrect.
400 IllegalParam.GatewayType The param of %s is illegal. Invalid GatewayType value.
400 UnsupportedFeature.Ipv6GatewayRouteTable The feature of %s is not supported. The border gateway route table cannot be associated with the gateway.
400 OperationDenied.IngressRoutingNotSupportAnycast The operation is not allowed because ingress routing not support anycast. The operation is not allowed because ingress routing not support anycast.
400 OperationDenied.ExistPublicIpv6IpInVpc Operation denied because IPV6 public ip exists in VPC. The operation failed because the ipv6 public IP exists in the VPC.
400 ResourceNotFound.Ipv6Gateway The specified resource of IPv6 Gateway is not found. The incoming IPv6 gateway instance does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.