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
已提问 3 年前3376 查看次数
1 回答
1
已接受的回答

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
已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则