Navigation

Create a New VPC Peering Connection

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

Syntax

POST /api/atlas/v1.0/groups/{GROUP-ID}/peers

Request Path Parameters

Parameter Required/Optional Description
GROUP-ID Required. The 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 Displays response in a prettyprint format. false
envelope boolean Specifies whether or not to wrap the response in an envelope. false

Request Body Parameters

Parameter Required/Optional Description
acceptorRegionName Required Specifies the AWS region where the peer VPC resides. See Amazon Web Services for a complete list of AWS regions supported by Atlas.
awsAccountId Required. The AWS account ID of the owner of the peer VPC.
containerId Required

The id of the Atlas VPC container for the AWS region.

You can create a Atlas VPC container using the POST /api/atlas/v1.0/groups/{GROUP-ID}/containers endpoint. You cannot create more than one container per AWS region.

To retrieve a list of container IDs, use the GET /api/atlas/v1.0/groups/{GROUP-ID}/containers endpoint.

routeTableCidrBlock Required. The peer VPC CIDR block or subnet.
vpcId Required. The ID of the peer VPC.

Response Elements

Field Description
acceptorRegionName Specifies the AWS region where the peer VPC resides. The return value is null if the region is the same region in which the Atlas VPC resides.
awsAccountId The AWS account ID of the owner of the peer VPC.
connectionId The peering connection ID.
containerId The id of the Atlas VPC container for the AWS region.
errorStateName

The error state, if any.

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

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

The status.

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

  • INITIATING
  • PENDING_ACCEPTANCE
  • FAILED
  • FINALIZING
  • AVAILABLE
  • TERMINATING
vpcId The ID of the peer VPC.

Example Request

curl -X POST -u 'username:apiKey' --digest "https://cloud.mongodb.com/api/atlas/v1.0/groups/5356823b3794dee37132bb7b/peers" \
   -H "Content-Type: application/json" --data '
   {
       "acceptorRegionName" : "us-west-1",
       "vpcId" : "vpc-123456",
       "awsAccountId" : "abc123abc123",
       "routeTableCidrBlock" : "192.168.0.0/24",
       "containerId" : "1112222b3bf99403840e8934"
   }'

Example Response

{
   "acceptorRegionName" : "us-west-1",
   "awsAccountId" : "999900000000",
   "connectionId" : null,
   "errorStateName" : null,
   "id" : "1112222b3bf99403840e8934",
   "routeTableCidrBlock" : "192.168.0.0/24",
   "statusName" : "INITIATING",
   "vpcId" : "vpc-abc123abc123",
   "containerId" : "1112222b3bf99403840e8934"
}