简体   繁体   中英

Connecting a MongoDB Atlas cluster to 2 AWS VPCs

I have 2 AWS accounts -- we'll call them AWSDev and AWSProd. I also have 2 MongoDB Atlas clusters under a single MongoDB account. I set up a Peer Connection for AWSProd's default VPC and added an entry into the AWSProd Route Table. Works great.

Now I'm setting up the peer connection for AWSDev's default VPC. The peer connection appears to be active, but my Lambda function is unable to connect.

I'm thinking that maybe the issue is that both my AWS VPCs run on the same CIDR block. See the green highlight in the following image: 在此处输入图像描述

Is this a problem? Will this mean MongoDB Atlas can only communicate with the first one because it's own routing tables can't differentiate between them?

Other things I've done to diagnose:

  1. I ensured the lambda is set up for my default VPC by setting it to run on my VPC's su.nets and under the security group.
  2. I verified the mongodb connection string is correct including the user and password.

I'm thinking about creating a new VPC in my AWSDev account and redeploying things to there to see if that resolves it. Any other ideas?

VPC Peering cannot use CIDR blocks which overlap:

https://docs.aws.amazon.com/vpc/latest/peering/create-vpc-peering-connection.html

It's also not possible to change or modify the IP address range of an existing virtual private cloud (VPC) or su.net. However, you can do one of the following:

-or-

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM