Navigation

Create One New VPC Peering Connection

Create one peering connection in one project.

Requires Private IP Mode

You must enable private IP mode to use GCP VPC peering.

Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project ID. For existing groups, your group/project ID remains the same. The resource and corresponding endpoints use the term groups.

Base URL: https://cloud.mongodb.com/api/atlas/v1.0

Resource

POST /groups/{GROUP-ID}/peers

Request Path Parameters

Parameter Type Necessity Description
GROUP-ID string Required Unique identifier for the project.

Request Query Parameters

This endpoint may use any of the HTTP request query parameters available to all Atlas API resources. These are all optional.

Name Type Description Default
pretty boolean Indicates whether the response body should be in a prettyprint format. false
envelope boolean

Indicates whether or not to wrap the response in an envelope.

Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query.

For endpoints that return one result, the response body includes:

status HTTP response code
envelope The expected response body
false

Request Body Parameters

Parameter Type Necessity Description
accepterRegionName string Required Specifies the region where the peer VPC resides. For complete lists of supported regions, see Amazon Web Services.
awsAccountId string Required Account ID of the owner of the peer VPC.
containerId string Required

Unique identifier of the Atlas VPC container for the region.

You can create an Atlas VPC container using the Create Container endpoint. You cannot create more than one container per region.

To retrieve a list of container IDs, use the Get list of VPC containers endpoint.

providerName string Optional Cloud provider for this VPC peering connection. If omitted, Atlas sets this parameter to AWS.
routeTableCidrBlock string Required Peer VPC CIDR block or subnet.
vpcId string Required Unique identifier of the peer VPC.
Parameter Type Necessity Description
containerId string Required

Unique identifier of the Atlas VPC container for GCP.

You can create a Atlas VPC container using the Create Container endpoint. You cannot create more than one GCP container per project.

To retrieve a list of container IDs, use the Get list of VPC containers endpoint.

gcpProjectId string Required GCP project ID of the owner of the peer VPC.
networkName string Required Name of the peer VPC.
providerName string Required Cloud provider for this VPC peering connection. Set this value to GCP.

Response Elements

Body Parameter Type Description
accepterRegionName string AWS region where the peer VPC resides. Returns null if the region is the same region in which the Atlas VPC resides.
awsAccountId string AWS account ID of the owner of the peer VPC.
connectionId string Unique identifier for the peering connection.
containerId string Unique identifier of the Atlas VPC container for the AWS region.
errorStateName string

Error state, if any.

The VPC peering connection error state value can be one of the following:

  • REJECTED
  • EXPIRED
  • INVALID_ARGUMENT
id string Atlas assigned unique ID for the connection. Only specific to and used by Atlas.
routeTableCidrBlock string Peer VPC CIDR block or subnet.
statusName string

The VPC peering connection status value can be one of the following:

  • INITIATING
  • PENDING_ACCEPTANCE
  • FAILED
  • FINALIZING
  • AVAILABLE
  • TERMINATING
vpcId string Unique identifier of the peer VPC.
Body Parameter Type Description
containerId string Unique identifier of the Atlas VPC container for GCP.
gcpProjectId string GCP project ID of the owner of the peer VPC.
errorMessage string When "status" : "FAILED", Atlas provides a description of the error.
id string Atlas assigned unique ID for the connection. Only specific to and used by Atlas.
networkName string Name of the peer VPC.
status string

The VPC peering connection status value can be one of the following:

  • ADDING_PEER
  • WAITING_FOR_USER
  • AVAILABLE
  • FAILED
  • DELETING

Example Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
curl --user '{USERNAME}:{APIKEY}' --digest \
 --header "Accept: application/json" \
 --header "Content-Type: application/json" \
 --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/5356823b3794dee37132bb7b/peers?pretty=true" \
 --data '
   {
     "accepterRegionName" : "us-west-1",
     "awsAccountId" : "abc123abc123",
     "containerId" : "507f1f77bcf86cd799439011",
     "providerName" : "AWS",
     "routeTableCidrBlock" : "192.168.0.0/24",
     "vpcId" : "vpc-abc123abc123"
   }'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
curl --user '{USERNAME}:{APIKEY}' --digest \
 --header "Accept: application/json" \
 --header "Content-Type: application/json" \
 --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/5356823b3794dee37132bb7b/peers?pretty=true" \
 --data '
   {
     "containerId" : "507f1f77bcf86cd799439011",
     "gcpProjectId" : "my-sample-project-191923",
     "networkName" : "test1",
     "providerName" : "GCP"
   }'

Example Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "accepterRegionName" : "us-west-1",
  "awsAccountId" : "999900000000",
  "connectionId" : null,
  "containerId" : "507f1f77bcf86cd799439011",
  "errorStateName" : null,
  "id" : "1112222b3bf99403840e8934",
  "routeTableCidrBlock" : "10.15.0.0/16",
  "statusName" : "INITIATING",
  "vpcId" : "vpc-abc123abc123"
}
1
2
3
4
5
6
7
{
  "containerId" : "507f1f77bcf86cd799439011",
  "gcpProjectId" : "my-sample-project-191923",
  "id" : "1112222b3bf99403840e8934",
  "networkName" : "test1",
  "status" : "ADDING_PEER"
}