• Virtual Private Cloud

vpc
  1. Help Center
  2. Virtual Private Cloud
  3. API Reference
  4. APIs
  5. VPC Peering Connection
  6. Creating a VPC Peering Connection

Creating a VPC Peering Connection

Function

This interface 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 Message

  • Request parameter
    Table 1 Request parameter

    Parameter

    Mandatory

    Type

    Mandatory

    Description

    peering

    Yes

    Dict

    Yes

    Specifies the VPC peering connection object list. For details, see Table 1.

    Mandatory fields: name and vpc_id in request_vpc_info and accept_vpc_info. If you create a VPC peering connection with a VPC of another tenant, you must specify the tenant_id in accept_vpc_info and do not need to specify the tenant_id in request_vpc_info.

  • Example request
    POST /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 Message

  • Response parameter
    Table 2 Response parameter

    Parameter

    Type

    Description

    peering

    Dict

    Specifies the VPC peering connection information. For details, see the peering object model.

  • 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 Codes

For details, see section Status Codes.