Advertises a VPN route to a VPC.

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 PublishVpnRouteEntry

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

RegionId String Yes cn-hangzhou

The ID of the region where the route of the VPN gateway is deployed. You can call the DescribeRegions operation to query the most recent region list.

ClientToken String No d7d24a21-f4ba-4454-9173-b3828dae492b

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

You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

Note If you do not set this parameter, the system automatically uses RequestId as ClientToken. RequestId may be different for each API request.
VpnGatewayId String Yes vpn-bp1a3kqjiiq9legfx****

The ID of the VPN gateway.

RouteDest String Yes 10.0.0.0/24

The destination CIDR block of the route of the VPN gateway.

NextHop String Yes vco-bp15oes1py4i66rmd****

The next hop of the route.

RouteType String Yes pbr

The type of the route of the VPN gateway. Valid values:

  • pbr: policy-based route
  • dbr: destination-based route
PublishVpc Boolean Yes true

Specifies whether to advertise the route of the VPN gateway to the route table of the associated VPC.

  • true: yes
  • false: no

Response parameters

Parameter Type Example Description
RequestId String 5BE01CD7-5A50-472D-AC14-CA181C5C03BE

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=PublishVpnRouteEntry
&NextHop=vco-bp15oes1py4i66rmd****
&PublishVpc=true
&RegionId=cn-hangzhou
&RouteDest=10.0.0.0/24
&RouteType=PBR
&VpnGatewayId=vpn-bp1a3kqjiiq9legfx****
&<Common request parameters>

Sample success responses

XML format

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

<PublishVpnRouteEntryResponse>
    <RequestId>EE4C2417-9437-4333-BDEB-8493F7AA7258</RequestId>
</PublishVpnRouteEntryResponse>

JSON format

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

{
  "RequestId" : "CB2793A8-845F-444C-8E93-76F1BBDF9C78"
}

Error codes

HttpCode Error code Error message Description
400 Resource.QuotaFull The quota of resource is full The error message returned because the resource quota is reached.
400 VpnGateway.Configuring The specified service is configuring. The error message returned because the specified service is being configured. Try again later.
400 VpnGateway.FinancialLocked The specified service is financial locked. The error message returned because the service is suspended due to overdue payments. Top up your account before you enable the service.
400 OperationFailed.RouteConflict Operation failed because there is already a route in VPC route table to another VPN on the same network block. The error message returned because a route that points to another VPN gateway already exists in the same CIDR block in the route table of the VPC.
400 QuotaExceeded.VpnRouteEntry The number of route entries to the VPN gateway in the VPC routing table has reached the quota limit. The error message returned because the number of routes that point to the VPN gateway in the VPC route table reaches the quota.
403 Forbbiden.SubUser User not authorized to operate on the specified resource as your account is created by another user. The error message returned because you are unauthorized to perform this operation on the specified resource. Apply for the required permissions and try again.
403 Forbidden 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.
404 InvalidVpnGatewayInstanceId.NotFound The specified vpn gateway instance id does not exist. The error message returned because the specified VPN gateway does not exist. Check whether the configuration of the VPN gateway is valid.

For a list of error codes, visit the API Error Center.