error-could-not-connect-to-any-servers-in-your-mongodb-atlas-cluster

0

Hi AWS, I know this might not be a right question for the community here but the point is my VPC is having IPv4 CIDR block of 172.31.0.0/16 and the Atlas VPC CIDR block is 10.8.0.0/21. The peering connection is available and I have even allow access from anywhere in MongoDB Atlas UI for the cluster but still experiencing the same issue. EC2 instance is the VPC with a public subnet.

I have tried every way possible but still same issue persists. Please help.

profile picture
asked a year ago614 views
1 Answer
0

Hi Arjun,

A few components that can potentially affect access here. Feel free to add additional details if needed.

Assuming that the peering connection is up/active, you would still need to route the CIDR blocks statically to reach hosts in the peered VPCs. You mentioned that you allowed access in MongoDB, but you also need to make sure you have the appropriate access in your Security Groups and VPC NACLs.

Example VPC Routing

Also, if these hosts are referencing each other via DNS hostnames, you may need to enable DNS hostnames in the associated VPCs.

From the public documentation regarding DNS: "With the default VPC peering connection options, if EC2 instances on either side of a VPC peering connection address each other using a public DNS hostname, the hostname resolves to the public IP address of the instance. To change this behavior, enable DNS hostname resolution for your VPC connection. After enabling DNS hostname resolution, if instances on either side of the VPC peering connection address each other using a public DNS hostname, the hostname resolves to the private IP address of the instance."

Hope this helps, if not, please post some additional details

Thanks!

AWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions