We are using an RDS instance in AWS, it is POSTGRES 13. We have Node-based Lambdas that return and post data to the database. Currently they are opening and closing a single connection per transaction and we want to optimise this by implementing connection pooling.
There is an AWS service specifically designed for handling DB connections called AWS RDS Proxy BUT it isn't compatible with POSTGRES 13. We are looking for alternative approaches and would really appreciate any insight in this regard.
We were thinking about pulling the DB connection outside of the Lambda handler so that it maintains state (until the Lambda gets removed) BUT this wouldn't be able to close its connection to the DB and we were concerned about filling up all the available connections. This may or may not be the case.
Much thanks,
Sam