Creating a VPC Peering Connection

Function

This API is used to create a VPC peering connection.

If you create a VPC peering connection with another VPC of your own, the connection is created without the need for you to accept the connection.

If you create a VPC peering connection with a VPC of another tenant, the peer tenant must accept the connection so that the connection can be created. If the peer tenant refuses the connection, it cannot be created.

URI

POST /v2.0/vpc/peerings

Request Parameters

Table 1 Request parameter

Parameter

Mandatory

Type

Description

peering

Yes

peering object

Specifies the VPC peering connection. For details, see Table 2.

Table 2 Description of the peering field

Attribute

Mandatory

Type

Description

name

Yes

String

Specifies the name of the VPC peering connection. The value can contain 1 to 64 characters.

description

No

String

Provides supplementary information about the VPC peering connection.

The value can contain no more than 255 characters and cannot contain angle brackets (< or >).

request_vpc_info

Yes

vpc_info object

Specifies information about the local VPC. For details, see Table 3.

accept_vpc_info

Yes

vpc_info object

Specifies information about the peer VPC. For details, see Table 3.

Table 3 Description of the vpc_info field

Attribute

Mandatory

Type

Description

vpc_id

Yes

String

Specifies the ID of a VPC involved in a VPC peering connection.

tenant_id

No

String

Specifies the ID of the project to which a VPC involved in the VPC peering connection belongs.

This parameter is mandatory if the VPC peering connection is created between VPCs in different accounts.

Example Request

  • Create a VPC peering connection. The VPC ID of the requester is 9daeac7c-a98f-430f-8e38-67f9c044e299, the VPC ID of the receiver is f583c072-0bb8-4e19-afb2-afb7c1693be5, and the VPC peering connection is named test.

    POST https://{Endpoint}/v2.0/vpc/peerings
    
    {
        "peering": {
            "name": "test",
            "request_vpc_info": {
               "vpc_id": "9daeac7c-a98f-430f-8e38-67f9c044e299"
            },
            "accept_vpc_info": {
               "vpc_id": "f583c072-0bb8-4e19-afb2-afb7c1693be5"
            }
        }
    }
    

Response Parameters

Table 4 Response parameter

Parameter

Type

Description

peering

peering object

Specifies the VPC peering connection. For details, see Table 5.

Table 5 peering objects

Attribute

Type

Description

id

String

Specifies the VPC peering connection ID.

name

String

Specifies the VPC peering connection name.

status

String

Specifies the VPC peering connection status. Possible values are as follows:

  • PENDING_ACCEPTANCE

  • REJECTED

  • EXPIRED

  • DELETED

  • ACTIVE

request_vpc_info

vpc_info object

Specifies information about the local VPC. For details, see Table 6.

accept_vpc_info

vpc_info object

Specifies information about the peer VPC. For details, see Table 6.

description

String

Provides supplementary information about the VPC peering connection.

created_at

String

Specifies the time (UTC) when the VPC peering connection is created.

Format: yyyy-MM-ddTHH:mm:ss

updated_at

String

Specifies the time (UTC) when the VPC peering connection is updated.

Format: yyyy-MM-ddTHH:mm:ss

Table 6 vpc_info objects

Attribute

Type

Description

vpc_id

String

Specifies the ID of a VPC involved in a VPC peering connection.

tenant_id

String

Specifies the ID of the project to which a VPC involved in the VPC peering connection belongs.

Example Response

{
    "peering": {
        "name": "test",
        "id": "22b76469-08e3-4937-8c1d-7aad34892be1",
        "request_vpc_info": {
           "vpc_id": "9daeac7c-a98f-430f-8e38-67f9c044e299",
           "tenant_id": "f65e9ebc-ed5d-418b-a931-9a723718ba4e"
        },
        "accept_vpc_info": {
           "vpc_id": "f583c072-0bb8-4e19-afb2-afb7c1693be5",
           "tenant_id": "f65e9ebc-ed5d-418b-a931-9a723718ba4e"
        },
        "status": "ACTIVE"
    }
}

Status Code

See Status Codes.

Error Code

See Error Codes.