AWS Lambda and MongoDB

Question:

I’m new to AWS Lambda and interested in trying it. I have a MongoDB instance that I want to connect to through my AWS lambda function. How would I connect to my mongo instance? I can’t load pymongo onto AWS Lambda so how would I get this to work in the Lambda function?

Answer:

You have to use Pymongo, you can download it using pip install pymongo -t <your_location> after that zip it with your code and any dependancy then upload it to the Lambda console

Leave a Reply