AWS Lambda To Atlas

▼魔方 西西 提交于 2020-01-03 05:43:07

问题


I want to connect my Lambda function to Mongo Atlas. It was all working fine but I needed to move my function inside a VPC so I could use redis.

Now I cannot connect to my database. I looked at the security group on the VPC and added the mongo db port but with no joy

Also - the mongo IP Whitelist is as follows for now 0.0.0.0/0 (includes your current IP address)

Is there anything else I should try?

Thank you


回答1:


I needed to move my function inside a VPC so I could use redis.

If you are:

  • Using dedicated MongoDB Atlas instances (i.e. not shared instances M0, M2 and M5 clusters).

  • And, the MongoDB Atlas deployment is hosted on AWS

Then, you could follow this instruction to set up VPC peering connection.

Please note that MongoDB Atlas supports VPC peering with other AWS VPCs in the same region. AWS does not support cross-region VPC peering. For multi-region clusters, you must create VPC peering connections per-region.

See also the tutorial shown on: Introducing VPC peering to MongoDB Atlas




回答2:


struggled for days using this tutorial https://www.mongodb.com/blog/post/introducing-vpc-peering-for-mongodb-atlas

but it work in the end, when i found a missing step in the tutorial; when i used default VPC.

When crating custom VPC, rout table, and subnet; the subnet was what got me... auto assign IP needs to be enabled on the subnet;

PS you need at least two subnets for Lambda, so create one more if you haven't



来源:https://stackoverflow.com/questions/50277533/aws-lambda-to-atlas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!