mongocli atlas networking peering gcp create

The networking peering create gcp command creates a peering connection between the Atlas VPC and your Google Cloud Platform VPC for a given Atlas project.

The networking peering create gcp command checks if a VPC exists for your Atlas project. If one exists, this command creates the peering connection between that VPC and your VPC. If an Atlas VPC does not exist, this command creates one and creates a connection between it and your VPC.

mongocli atlas networking peering gcp create
[ --atlasCidrBlock <atlas-cidr-block> ]
--gcpProjectId <gcp-project-id>
--network <gcp-vpc-name>
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
[ --projectId <project-ID> ]

Use -h or --help to view the command-line help for this command.


CIDR block that Atlas uses for your clusters. Required only if you do not already have an Atlas VPC.

Atlas uses the specified CIDR block for all other VPC peering connections created in the project. The Atlas CIDR block must be at least a /18 in one of the following private networks:

Lower Bound
Upper Bound

Atlas locks this value if an M10+ cluster or a VPC peering connection already exists. To modify the CIDR block, ensure there are no M10+ clusters in the project and no other VPC peering connections in the project.

Alternatively, create a new project and create a VPC Peering Connection to set the desired Atlas VPC CIDR block for that project.


Atlas limits the number of MongoDB nodes per VPC based on the CIDR block and the region selected for the project.


A project with an Atlas VPC CIDR block of /18 is limited to approximately 80 three-node replica sets per GCP region.

Contact MongoDB Support for any questions on Atlas limits of MongoDB nodes per VPC .

Unique identifer of the Google Cloud Platform project that contains your VPC.
Name of the peer VPC.
--output, -o

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using the Go template file

If omitted, the command returns output in the default format.

--profile, -P
Name of the profile where the public and private keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.

Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable.


If the command succeeds, it returns the following output in the default format. If the command returns errors, see Troubleshooting for recommended solutions.

Network peering connection '<peering-connection-id>' created.

The default output is a subset of the fields returned by this command. For the complete list of JSON fields returned by the command, see the Public API reference for your MongoDB service:

The following command creates a peering connection between the Atlas VPC and your GCP VPC for a project using the default profile, which contains credentials and the project ID. The output is returned in the default format.

mongocli atlas networking peering create gcp --atlasCidrBlock \
--gcpProjectId grandiose-branch-256701 --network mongocli-test \
--projectId 5f0e15e3d52a043fed8b1c92

The previous command prints the following to the terminal.

Network peering connection '5f621dc701240c5b7c3a888e' created.
Give Feedback