Creating a Route to the Peer VPC
Function
You need to create the routes for both the receiver (local VPC) and the sender (peer VPC). For details about how to create a local route, see Creating a Route to the Local VPC.
The prerequisite for calling this API is that the VPC peering connection request has been accepted. For details, see Accepting a VPC Peering Connection Request.
Use the following method to send a request to the endpoint of the peer VPC:
POST https://VPC endpoint/v2.0/vpc/routes
URI
POST /v2.0/vpc/routes
Request
- Example request
POSThttps: //{Endpoint}/v2.0/vpc/routes { "route": { "type": "peering", "nexthop": "60c809cb-6731-45d0-ace8-3bf5626421a9", "destination": "192.168.200.0/24", "vpc_id": "ab78be2d-782f-42a5-aa72-35879f6890ff" } } - Parameter description
Table 1 Request parameter Parameter
Mandatory
Description
route
Yes
Route object list. For details, see Table 2.
Table 2 route objects Attribute
Type
Mandatory
Description
destination
String
Yes
Destination address in the CIDR notation format, for example, 192.168.200.0/24.
nexthop
String
Yes
Next hop. If the route type is peering, enter the VPC peering connection ID.
type
String
Yes
Route type. Currently, the value can only be peering.
vpc_id
String
Yes
ID of the VPC requesting for creating a route.
Response
- Example response
{ "route": { "type": "peering", "nexthop": "60c809cb-6731-45d0-ace8-3bf5626421a9", "destination": "192.168.200.0/24", "vpc_id": "ab78be2d-782f-42a5-aa72-35879f6890ff", "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f", "id": "3d42a0d4-a980-4613-ae76-a2cddecff054" } } - Parameter description
Table 3 Parameter
Type
Description
route
Object
Route object list. For details, see Table 4.
Table 4 Response parameters Attribute
Type
Description
id
String
ID of a route.
destination
String
Destination address in the CIDR notation format, for example, 192.168.200.0/24.
nexthop
String
Next hop. If the route type is peering, enter the VPC peering connection ID.
type
String
Route type. Currently, the value can only be peering.
vpc_id
String
VPC of the route. Set this parameter to the existing VPC ID.
tenant_id
String
Status Code
| Status Code | Description |
|---|---|
| 201 | A route is created successfully. |
| 400 | The input parameter is invalid. |
| 500 | Failed to complete the request because of an internal service error. |
Error Code
For details, see Error Codes.
Last Article: Creating a Route to the Local VPC
Next Article: Query the Route List
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.