mongocli atlas networking peering aws create
The networking peering create aws
command creates a peering
connection between the Atlas VPC and your AWS VPC for
a given Atlas project.
The networking peering create aws
command checks if a VPC exists for
your Atlas project. If one exists, the MongoDB CLI creates the peering
connection between that VPC and your VPC. If an Atlas VPC does not
exist, the MongoDB CLI creates one and creates a connection between it and
your VPC.
Syntax
mongocli atlas networking peering aws create --accountId <aws-account-id> [ --atlasCidrBlock <atlas-cidr-block> ] --region <atlas-vpc-region> --routeTableCidrBlock <vpc-cidr-block-or-subnet> --vpcId <aws-vpc-id> [ --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? | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
--accountId | string | AWS Account ID of the owner of the peer VPC. | yes | ||||||||||||
--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 Network 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 Network Peering Connection to set the desired Atlas VPC CIDR block for that project. ImportantAtlas limits the number of MongoDB nodes per Network Peering connection based on the CIDR block and the region selected for the project. ExampleA project in an AWS region supporting 3 availability
zones and a Atlas CIDR VPC block of Contact MongoDB Support for any questions on Atlas limits of MongoDB nodes per VPC. | no | ||||||||||||
--region | string | AWS region in which the peer VPC resides. See the
Atlas documentation for a list
of supported regions. | yes | ||||||||||||
--routeTableCidrBlock | string | Peer AWS VPC CIDR block or subnet. | yes | ||||||||||||
--vpcId | string | Unique identifier of the peer AWS 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 AWS VPC for a project using the default profile, which contains credentials and the project ID. The output is returned in the default format.
atlas networking peering create aws --accountId <aws-account-id> \ --atlasCidrBlock 192.168.0.0/24 --region us-east-1 \ --routeTableCidrBlock 10.0.0.0/24 --vpcId vpc-078ac381aa90e1e63
The previous command prints the following to the terminal.
Network peering connection '5f60c5bd0948295c093565ba' created.
The following command creates a peering connection between the Atlas VPC and your AWS VPC for a project using the default profile, which contains credentials and the project ID. The output is returned in JSON format.
atlas networking peering create aws --accountId <aws-account-id> \ --atlasCidrBlock 192.168.0.0/24 --region us-east-1 \ --routeTableCidrBlock 10.0.0.0/24 --vpcId vpc-078ac381aa90e1e63 \ --output json
The previous command prints the following to the terminal in JSON format.
{ "awsAccountId": "<aws-account-id>", "containerId": "5f4eb2178c9ff67e809a3619", "id": "5f60c5bd0948295c093565ba", "routeTableCidrBlock": "10.0.0.0/24", "statusName": "INITIATING", "vpcId": "vpc-078ac381aa90e1e63" }