Cannot connect to a multi-region replicaset from secondary region

Good day! Quite new to developing with MongoDB Atlas and I just provisioned a multi-region replicaset for my atlas cluster, with:

  • 2 nodes, including primary, in eu-west-1
  • 2 nodes in us-east-1
  • 1 node in ap-southeast-1
  • all regions with AWS PrivateLink configured

I’m able to connect to my cluster just fine from a server located in eu-west-1 but when I try to connect with the same mongodb+srv and same credentials from a server in us-east-1, I’m getting the following error:
Error: Could not find host matching read preference { mode: “primary”, tags: [ {} ] } for set atlas-xxx

Apologies if I’m missing something very obvious here. Thank you!

Hi @Jose_Jimenez3 - Welcome to the community!

Curious to know more details about how you have your AWS PrivateLink configured at a high level - Could you describe this? I’m wondering if it’s due to (as per the limitations section of the private endpoint documentation):

  • To connect to Atlas database deployments using AWS PrivateLink from regions in which you haven’t deployed a private endpoint connection, you must peer VPCs in those regions to VPCs in a region in which you have deployed a private endpoint connection.
    To learn about inter-region VPC peering, see the AWS documentation.

I.e. Do you have a VPC peering connection from your VPC in us-east-1 (Client side) to your VPC in `eu-west-1) (Client side)?

Look forward to hearing from you.

Regards,
Jason

Sorry Jose - I misread and confused myself with private endpoints :slight_smile: Just clarifying you only have AWS VPC peering configured from your environment to the Atlas cluster is this correct?

In this case, are you able to ping the 1 node from each region from the us-east-1 host to see if the IP addresses returned are private addresses (should be addresses that exist within the configured Atlas CIDR when setting up the VPC Peering connections in Atlas).

Additionally, when you state “all regions with AWS PrivateLink configured” is this all the Atlas regions to both the us-east-1 and eu-west-1 VPC you have on your AWS end?

Regards,
Jason