Associates a route table with a gateway endpoint.

Usage notes

When you call this operation, take note of the following limits:

  • The gateway endpoint to be associated with the route table cannot be in one of the following states: Creating, Modifying, Associating, Dissociating, or Deleting.
  • The route table cannot be in one of the following states: Creating, Modifying, Associating, Dissociating, or Deleting.
  • The gateway endpoint and route table must belong to the same virtual private cloud (VPC).
  • The route table cannot be shared.
  • You cannot associate a gateway endpoint with a virtual border router (VBR) route table.
  • You can associate a gateway endpoint with at most 20 route tables at a time.
  • AssociateRouteTablesWithVpcGatewayEndpoint is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. You can call the GetVpcGatewayEndpointAttribute operation to query whether a route table is associated with a gateway endpoint.
    • If the Associating status is returned, the route table is being associated with the gateway endpoint.
    • If the Created status is returned, the route table is associated with the gateway endpoint.
  • You cannot repeatedly call the AssociateRouteTablesWithVpcGatewayEndpoint operation within a specific period of time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes AssociateRouteTablesWithVpcGatewayEndpoint

The operation that you want to perform. Set the value to AssociateRouteTablesWithVpcGatewayEndpoint.

EndpointId String Yes vpce-m5e371h5clm3uadih****

The ID of the gateway endpoint to be associated with the route table.

RouteTableIds.N String Yes vtb-m5elgtm3aj586iitr****

The ID of the route table. Valid values of N are 1 to 20, which specifies that you can associate a gateway endpoint with at most 20 route tables at a time.

ClientToken String No 5A2CFF0E-5718-45B5-9D4D-70B3FF3898

The client token that is used to ensure the idempotence of the request. You can use the client to generate a client token. Make sure that a unique client token is used for each request. The client token can contain only ASCII characters and cannot exceed 64 characters in length.

Note If you do not set this parameter, the system uses RequestId as ClientToken. The value of RequestId of each API request may be different.
DryRun Boolean No false

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system checks your AccessKey pair, the RAM user permissions, and the required parameters. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and sends the request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
RegionId String Yes cn-hangzhou

The region ID of the gateway endpoint.

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

Response parameters

Parameter Type Example Description
RequestId String 59BDDA2D-FB52-59F9-9DC5-5EA7D6808B8E

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AssociateRouteTablesWithVpcGatewayEndpoint
&EndpointId=vpce-m5e371h5clm3uadih****
&RouteTableIds=["vtb-m5elgtm3aj586iitr****"]
&ClientToken=5A2CFF0E-5718-45B5-9D4D-70B3FF3898
&DryRun=false
&RegionId=cn-hangzhou
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AssociateRouteTablesWithVpcGatewayEndpointResponse>
    <RequestId>59BDDA2D-FB52-59F9-9DC5-5EA7D6808B8E</RequestId>
</AssociateRouteTablesWithVpcGatewayEndpointResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "59BDDA2D-FB52-59F9-9DC5-5EA7D6808B8E"
}

Error codes

HttpCode Error code Error message Description
400 Forbbiden User not authorized to operate on the specified resource. The error message returned because you are unauthorized to perform this operation on the specified resource. Apply for the required permissions and try again.
400 InvalidRegionId.NotFound The regionId provided does not exist in our records. The error message returned because the ID of the specified region does not exist. Check whether the region ID is valid.

For a list of error codes, see Service error codes.