Using DocumentDB with Lambda: connection pooling

0

I would like to implement a modern web app with serverless compute using AWS Lambda and Amazon DocumentDB. How can I manage efficiently connections to the DB? Is there a connection pool mechanism, like the one you have when using Amazon RDS Proxy, to avoid opening and closing connections from every Lambda execution?

Thanks a lot!

AWS
asked 3 years ago3314 views
1 Answer
1
Accepted Answer

Best practices are similar to what you would do when connecting to another data store: declare the variable holding the connection to the database outside your handler so it can be re-utilized by subsequent invocations of your function.

You can find a good example here: https://docs.atlas.mongodb.com/best-practices-connecting-to-aws-lambda.

AWS
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions