For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Configure Network Peering

Note

  • This feature is not available for M0 clusters and Flex clusters.

Atlas supports network peering connections for dedicated clusters hosted on AWS, Google Cloud, and Azure, and on multi-cloud sharded clusters.

Network peering establishes a private connection between your Atlas VPC and your cloud provider's VPC. The connection isolates traffic from public networks for added security.

Atlas doesn't support network peering between clusters you deploy in a single region on different cloud providers.

To manage your network peering connections with Atlas Kubernetes Operator, you can specify and update the spec.networkPeers parameter for the AtlasProject Custom Resource. Each time you change the spec field in any of the supported custom resources, Atlas Kubernetes Operator creates or updates the corresponding Atlas configuration.

To configure network peering using Atlas Kubernetes Operator, you require:

  • A running Kubernetes cluster with Atlas Kubernetes Operator deployed.

  • The Project Owner or Organization Owner role in Atlas.

  • If you have not already done so, create your VPC in AWS. To learn more, see Get Started with Amazon VPC.

  • A network traffic rule for outbound traffic.

    Create the following network traffic rule on your AWS security group attached to your resources that connect to Atlas:

    Permission
    Direction
    Port
    Target

    Allow

    outbound

    27015-27017 inclusive

    to your Atlas CIDR

Enable clients to connect to Atlas clusters using a network peering connection with the following procedure:

1

You can configure network peering to use an existing container or a new container.

  1. Specify the spec.networkPeers parameter in the AtlasProject Custom Resource. Replace the following placeholders with your values:

    Placeholder
    Description

    spec.networkPeers.providerName

    Cloud provider name. Specify AWS.

    spec.networkPeers.containerId

    Unique identifier for the network peering container you want to use. If you don't specify containerId, you must set atlasCIDRblock. To learn more, see the Create New Container section in this procedure.

    spec.networkPeers.accepterRegionName

    AWS region for your VPC.

    spec.networkPeers.awsAccountId

    Unique identifier for your AWS account. AWS displays the account ID when you click the account name in the top right corner of the console home page.

    spec.networkPeers.routeTableCidrBlock

    CIDR block for your AWS VPC. AWS displays the CIDR block on your VPC's details page.

    spec.networkPeers.vpcId

    Unique identifier for your AWS VPC. AWS displays the VPC ID on your VPC's details page.

  2. Run the following command:

    cat <<EOF | kubectl apply -f -
    apiVersion: atlas.mongodb.com/v1
    kind: AtlasProject
    metadata:
    name: my-project
    spec:
    name: Test Atlas Operator Project
    networkPeers:
    - providerName: "AWS"
    containerID: "6dc5f17280eef56a459fa3fb"
    accepterRegionName: "us-east-2"
    awsAccountId: "12345678"
    routeTableCidrBlock: "10.0.0.0/24"
    vpcId: "vpc-12345678"
    EOF
  1. Specify the spec.networkPeers parameter in the AtlasProject Custom Resource. Replace the following placeholders with your values:

    Placeholder
    Description

    spec.networkPeers.providerName

    Cloud provider name. Specify AWS.

    spec.networkPeers.atlasCidrBlock

    Atlas CIDR block for which Atlas Kubernetes Operator creates a new container. If you don't specify atlasCidrBlock, you must specify the containerId of an existing container. To learn more, see the Use Existing Container section in this procedure.

    spec.networkPeers.containerRegion

    (Optional) AWS region in which Atlas Kubernetes Operator creates a new container. If you don't specify either a containerRegion or a containerId, Atlas Kubernetes Operator creates a new container in the same region as the accepterRegionName.

    spec.networkPeers.accepterRegionName

    AWS region for your VPC.

    spec.networkPeers.awsAccountId

    Unique identifier for your AWS account. AWS displays the account ID when you click the account name in the top right corner of the console home page.

    spec.networkPeers.routeTableCidrBlock

    CIDR block for your AWS VPC. AWS displays the CIDR block on your VPC's details page.

    spec.networkPeers.vpcId

    Unique identifier for your AWS VPC. AWS displays the VPC ID on your VPC's details page.

  2. Run the following command:

    cat <<EOF | kubectl apply -f -
    apiVersion: atlas.mongodb.com/v1
    kind: AtlasProject
    metadata:
    name: my-project
    spec:
    name: Test Atlas Operator Project
    networkPeers:
    - providerName: "AWS"
    atlasCidrBlock: "10.8.0.0/21"
    containerRegion: "us-west-1"
    accepterRegionName: "us-east-2"
    awsAccountId: "12345678"
    routeTableCidrBlock: "10.0.0.0/24"
    vpcId: "vpc-12345678"
    EOF
2
  1. Run the following command:

    kubectl get atlasprojects my-project -o=jsonpath='{.status.networkPeers.statusName}'
    WAITING FOR USER
  2. If the statusName value is WAITING FOR USER, proceed to the next step. If the statusName is not WAITING FOR USER, wait a few minutes and try this step again.

3

To learn more, see Accept a VPC peering connection.

4

Run the following command again to check the status of the VPC connection. Atlas Kubernetes Operator returns READY when the network peering connection is complete.

kubectl get atlasprojects my-project -o=jsonpath='{.status.networkPeers.statusName}'
READY
Rate this page