I am using AWS-lambda handler to write a dynamoDB stream to mongoDB. I want to define the db connection outside of the handler so that the requests reuse the same connections, based on our expected throughput volume. The problem with the lambda containers will expire without disposing of the connections properly.
Does anybody know of any good solutions for this problem? Essentially boils down to "I want to use connection pools without maxing out the connection limit"