Aws vpc peering

I have configured perring connection with aws. i run host command using one of cluster host it resolve the private ip. but cannot connect using connection string in that instance.

Thare are 3 shard when ping each shard resolve the private ip

i need to find connection string to access 3 shard

atlas vpc peering.drawio

from ec2 i can resolve private ip primary and secondary host but cannot connect through the connection string

Hi @supun_madushanka,

Welcome to the community :slight_smile:

I assume this is for an Atlas project in which you have set up VPC peering with your own AWS VPC. Please correct me if I am wrong in my assumption here.

i run host command using one of cluster host it resolve the private ip. but cannot connect using connection string in that instance.

Can you provide some more details regarding your connection attempts? I.e.:

  1. Are you using mongosh, MongoDB Compass or through one of the MongoDB drivers?
  2. What errors are you getting when trying to connect?

i need to find connection string to access 3 shard

What is the connection string you are using at the moment? Please redact any credentials before posting it here.

When going through the connect modal window in Atlas, it should provide you with a SRV connection string or all hostnames of the nodes within the cluster when choosing the standard connection string which is available with older versions of particular connections. The SRV record should resolve all the hostnames contained within the cluster.

from ec2 i can resolve private ip primary and secondary host but cannot connect through the connection string

DNS hostnames and DNS resolution sound like they are enabled here but the connectivity issue could be due to security group rules or even routing. Be sure to allow the following outbound rules for the security group that client(s) are associated with. Regarding the route tables, please see step 4 in the Set up a Network Peering Connection documentation.

Hope this helps.

Best Regards,
Jason

1 Like