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.
Syntax
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> ]
Note
Use -h
or --help
to view the command-line help for
this command.
Options
Option | Type | Description | Required? | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
--atlasCidrBlock | string | 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
Atlas locks this value if an Alternatively, create a new project and create a VPC Peering Connection to set the desired Atlas VPC CIDR block for that project. ImportantAtlas limits the number of MongoDB nodes per VPC based on the CIDR block and the region selected for the project. ExampleA project with an Atlas VPC CIDR block of
Contact MongoDB Support for any questions on Atlas limits of MongoDB nodes per VPC. | no | ||||||||||||
--gcpProjectId | string | Unique identifer of the Google Cloud Platform project that
contains your VPC. | yes | ||||||||||||
--network | string | Name of the peer VPC. | yes | ||||||||||||
--output , -o | string | Command output format. Valid values are:
If omitted, the command returns output in the default format. | no | ||||||||||||
--profile , -P | string | 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. | no | ||||||||||||
--projectId | string | Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable. | no |
Output
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:
Example
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 192.168.0.0/18 \ --gcpProjectId grandiose-branch-256701 --network mongocli-test \ --projectId 5f0e15e3d52a043fed8b1c92
The previous command prints the following to the terminal.
Network peering connection '5f621dc701240c5b7c3a888e' created.
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 JSON format.
mongocli atlas networking peering create gcp --atlasCidrBlock 192.168.0.0/18 \ --gcpProjectId grandiose-branch-256701 --network mongocli-test \ --projectId 5f0e15e3d52a043fed8b1c92 --output json
The previous command prints the following to the terminal in JSON format.
{ "containerId": "5f621dc701240c5b7c3a888d", "id": "5f621dc701240c5b7c3a888e", "status": "ADDING_PEER", "gcpProjectId": "grandiose-branch-256701", "networkName": "mongocli-test" }