AWS lambda peering connection error

Hello everyone,

I am trying to perform a query to a serverless MongoDB cluster from a lambda function in a private subnet, through a peered connection following the steps suggested in the provided Set Up a Network Peering Connection — MongoDB Atlas. However, it always returns the message ‘connection 1 to *IP:27017 closed’ .

Here is the configuration I have:

  • MongoDB Peering Connection active.

  • AWS Peering Connection active.

In the route table of VPC-xxx, the CIDR of the MongoDB VPC has been added. In the route table of the private subnet xxx, the CIDR of the MongoDB VPC has been added.

  • AWS Lambda associated with VPC-xxxx and private subnet xxxx, and rout tables.

When I add access from all sources to the IP Access list, it connects successfully. I have followed the steps for the connection, but I am unable to achieve successful communication. Any ideas on what configuration steps might be missing?

Hi @Angello_Ignacio - Welcome to the community :wave:

If the MongoDB Atlas cluster is of the serverless instance type, then unfortunately you won’t be able to connect to it through a peering connection as it’s currently unsupported as per the Serverless Limitations documentation.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.