Create Peer Connection
Last Updated:2020-07-20
Description
Create a peer connection
- For the peer connection with the same local region and opposite terminal region, only the post-payment is supported.
- For the cross-account peer connection, the peer connection is available only after being accepted by the acceptor.
- For the peer connection of the same account, the system will trigger the opposite terminal for automatic acceptance.
- Only one peer connection exists between any two VPC.
- The VPC of the initiator and the acceptor cannot be the same.
- If the local vpc and opposite terminal vpc are both relay vpc, the peer connection cannot be established.
Request Structure
POST /v{version}/peerconn?clientToken={clientToken} HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: authorization string
{
"bandwidthInMbps" : bandwidthInMbps,
"description" : description,
"localIfName" : localIfName,
"localVpcId" : localVpcId,
"peerAccountId": peerAccountId,
"peerVpcId" : peerVpcId,
"peerRegion" : peerRegion,
"peerIfName" : peerIfName,
"billing": {
"paymentTiming": paymentTiming,
"reservation": {
"reservationLength": reservationLength,
"reservationTimeUnit": reservationTimeUnit
}
}
}
Request Header
There are no other special headers except the public headers.
Request Prameter
Parameter name | Type | Required or not | Parameter position | Description |
---|---|---|---|---|
version | String | Yes | URL parameter | API version number (the current value is 1) |
clientToken | String | Yes | Query parameter | Idempotence Token is an ASCII string with length not exceeding 64 bytes, for details, please see ClientToken Idempotence |
bandwidthInMbps | int | Yes | RequestBody parameter | peer connection bandwidth |
description | String | No | RequestBody parameter | peer connection comments |
localIfName | String | No | RequestBody parameter | Local interface name |
localVpcId | String | Yes | RequestBody parameter | ID of local VPC |
peerAccountId | String | No | RequestBody parameter | The ID of opposite terminal account requires the field only when the cross-account peer connection is established. |
peerVpcId | String | Yes | RequestBody parameter | ID of opposite terminal VPC of peer connection |
peerRegion | String | Yes | RequestBody parameter | Opposite terminal region of peer connection |
peerIfName | String | No | RequestBody parameter | For the opposite terminal interface name of the peer connection, only the peer connection of the account allows to set the field. |
billing | Billing | Yes | RequestBody parameter | Billing information |
Return Header
There are no other special headers except the public headers.
Return Parameter
Parameter name | Type | Description |
---|---|---|
peerConnId | String | ID of created peer connection |
Request Example - Current - Account
POST /v1/peerconn?clientToken=be31b98c-5e51-48e8-9830-9be700de5a20 HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: bce-auth-v1/930192808c0c11e8b62ccf3a4a052967/2018-07-20T11:06:43Z/3600/host;x-bce-account;x-bce-client-ip;x-bce-date;x-bce-request-id;x-bce-security-token/749f35181233d0f744f30e77457dc605c6eed31c9a45856e2bf8c415245d9af1
ContentType: application/json
{
"bandwidthInMbps":500,
"description":"peer_same_account",
"localIfName":"localIfName",
"localVpcId":"vpc-13vuxu016dew",
"peerVpcId":"vpc-jcvmhw9h1a35",
"peerRegion":"bj",
"peerIfName":"peerIfName",
"billing":{
"paymentTiming":"Postpaid"
}
}
Request Example - Cross - Account
POST /v1/peerconn?clientToken=be31b98c-5ss1-4638-9530-9be700de5a20 HTTP/1.1
Host: bcc.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/930192808c0c11e8b62ccf3a4a052967/2018-07-20T11:06:43Z/3600/host;x-bce-account;x-bce-client-ip;x-bce-date;x-bce-request-id;x-bce-security-token/749f35181233d0f744f30e77457dc605c6eed31c9a45856e2bf8c415245d9af1
{
"bandwidthInMbps":500,
"description":"peer_diff_account",
"localIfName":"sss",
"localVpcId":"vpc-zuqfiksbu5cu",
"peerAccountId":"7058ff6052254a679f5714548feda935",
"peerVpcId":"vpc-mivwn2w9xicb",
"peerRegion":"bj",
"billing":{
"paymentTiming":"Postpaid"
}
}
Return Example
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
Date: Fri, 06 July 2018 07:06:06 GMT
Content-Type: application/json;charset=UTF-8
Server: BWS
{
"peerConnId": "peerconn-9td54fmx143e"
}