Hi guys, for the initial problem, a connection between aws lambda and MongoDB atlas.
My team and I faced the same problem and we could solve it by setting up a static IP address for the lambda, we put it in a private subnet and then used a NAT gateway, then you can add that IP to your MongoDB whitelist or you can keep your IP access list as 0.0.0.0/0, it will work both ways.
I don’t know how aws make requests through lambdas or why is a static IP needed, but that solution works.
Hope that can help you