Create One Network Peering Container
Creates one new network peering container in the specified project. MongoDB Cloud can deploy Network Peering connections in a network peering container. GCP can have one container per project. AWS and Azure can have one container per cloud provider region. To use this resource, the requesting Service Account or API Key must have the Project Owner role.
Path parameters
-
Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
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.
Format should match the following pattern:
^([a-f0-9]{24})$
.
Query parameters
-
Flag that indicates whether Application wraps the response in an
envelope
JSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as an envelope. Application adds the status parameter to the response body.Default value is
false
. -
Flag that indicates whether the response body should be in the prettyprint format.
Default value is
false
.Prettyprint
Body
object
Required
Creates one new network peering container in the specified project.
Collection of settings that configures the network container for a virtual private connection on Amazon Web Services.
-
Cloud service provider that serves the requested network peering containers.
Value is
AZURE
. -
IP addresses expressed in Classless Inter-Domain Routing (CIDR) notation that MongoDB Cloud uses for the network peering containers in your project. MongoDB Cloud assigns all of the project's clusters deployed to this cloud provider an IP address from this range. MongoDB Cloud locks this value if an M10 or greater cluster or a network peering connection exists in this project.
These CIDR blocks must fall within the ranges reserved per RFC 1918. AWS and Azure further limit the block to between the
/24
and/21
ranges.To modify the CIDR block, the target project cannot have:
- Any M10 or greater clusters
- Any other VPC peering connections
You can also create a new project and create a network peering connection to set the desired MongoDB Cloud network peering container CIDR block for that project. MongoDB Cloud limits the number of MongoDB nodes per network peering connection based on the CIDR block and the region selected for the project.
Example: A project in an Amazon Web Services (AWS) region supporting three availability zones and an MongoDB CIDR network peering container block of limit of
/24
equals 27 three-node replica sets.Format should match the following pattern:
^((([0-9]{1,3}\.){3}[0-9]{1,3})|(:{0,2}([0-9a-f]{1,4}:){0,7}[0-9a-f]{1,4}[:]{0,2}))((%2[fF]|/)[0-9]{1,3})+$
. -
Azure region to which MongoDB Cloud deployed this network peering container.
Values are
US_CENTRAL
,US_EAST
,US_EAST_2
,US_EAST_2_EUAP
,US_NORTH_CENTRAL
,US_WEST
,US_SOUTH_CENTRAL
,EUROPE_NORTH
,EUROPE_WEST
,US_WEST_CENTRAL
,US_WEST_2
,US_WEST_3
,CANADA_EAST
,CANADA_CENTRAL
,BRAZIL_SOUTH
,BRAZIL_SOUTHEAST
,AUSTRALIA_EAST
,AUSTRALIA_SOUTH_EAST
,AUSTRALIA_CENTRAL
,AUSTRALIA_CENTRAL_2
,UAE_NORTH
,GERMANY_WEST_CENTRAL
,GERMANY_NORTH
,SWITZERLAND_NORTH
,SWITZERLAND_WEST
,SWEDEN_CENTRAL
,SWEDEN_SOUTH
,UK_SOUTH
,UK_WEST
,INDIA_CENTRAL
,INDIA_WEST
,INDIA_SOUTH
,CHINA_EAST
,CHINA_NORTH
,ASIA_EAST
,JAPAN_EAST
,JAPAN_WEST
,ASIA_SOUTH_EAST
,KOREA_CENTRAL
,KOREA_SOUTH
,FRANCE_CENTRAL
,FRANCE_SOUTH
,SOUTH_AFRICA_NORTH
,SOUTH_AFRICA_WEST
,NORWAY_EAST
,NORWAY_WEST
,UAE_CENTRAL
,QATAR_CENTRAL
,POLAND_CENTRAL
,ISRAEL_CENTRAL
,ITALY_NORTH
,SPAIN_CENTRAL
,MEXICO_CENTRAL
, orNEW_ZEALAND_NORTH
.
atlas api createPeeringContainer --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20250312001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
client, err := sdk.NewClient(
sdk.UseOAuthAuth(clientID, clientSecret),
sdk.UseBaseURL(url))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.CreatePeeringContainerApiParams{}
sdkResp, httpResp, err := client.NetworkPeeringApi.
CreatePeeringContainerWithParams(ctx, params).
Execute()
}
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/containers" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/containers" \
-d '{ <Payload> }'
{
"providerName": "AWS",
"atlasCidrBlock": "string",
"region": "US_CENTRAL"
}
{
"providerName": "AWS",
"atlasCidrBlock": "string",
"regions": [
"AFRICA_SOUTH_1"
]
}
{
"providerName": "AWS",
"atlasCidrBlock": "string",
"regionName": "US_EAST_1"
}
{
"id": "32b6e34b3d91647abb20e7b8",
"providerName": "AWS",
"provisioned": true,
"atlasCidrBlock": "string",
"azureSubscriptionId": "32b6e34b3d91647abb20e7b8",
"region": "US_CENTRAL",
"vnetName": "string"
}
{
"id": "32b6e34b3d91647abb20e7b8",
"providerName": "AWS",
"provisioned": true,
"atlasCidrBlock": "string",
"gcpProjectId": "string",
"networkName": "string",
"regions": [
"AFRICA_SOUTH_1"
]
}
{
"id": "32b6e34b3d91647abb20e7b8",
"providerName": "AWS",
"provisioned": true,
"atlasCidrBlock": "string",
"regionName": "US_EAST_1",
"vpcId": "vpc-b555d3b0d9cb783b0"
}
{
"error": 400,
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"reason": "Bad Request",
"errorCode": "VALIDATION_ERROR"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 409,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot delete organization link while there is active migration in following project ids: 60c4fd418ebe251047c50554",
"reason": "Conflict",
"errorCode": "CANNOT_DELETE_ORG_ACTIVE_LIVE_MIGRATION_ATLAS_ORG_LINK"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}