Hello,
We are having problems because the database is getting overwhelmed because all the database connections are being consumed by a lambda.
I would like to know the best practices to avoid consuming all the connections.
It is a development environment so provisioning the database with another higher instance type with more VCPU doesn't make sense.
I do not really understand the parallelism of the lambdas. What we assumed so far:
- A request is made --> lambda X is raised --> a connection is created.
- Will requests executed on the hot lambda in an already started environment reuse the same database connection?
- For each "provisioning of a new environment" (init in the image), a connection is created?
Is this statement correct?

- When would the connection be released if the connection is not explicitly closed? Will the db-connection to the Lambda death event be released?
Is it better practice to close the connection explicitly or to leave it open? Is there a cost to open and close connections for each request processed?
https://docs.aws.amazon.com/lambda/latest/dg/lambda-concurrency.html
https://stackoverflow.com/questions/70317250/should-i-close-an-rds-proxy-connection-inside-an-aws-lambda-function
Would it be needed to close the connections with the RDS proxy? Would implementing the proxy properly involve code changes or just change the endopoint ?
Hi Diego, no, management of sessions is done by the proxy, which multiplexes their use by different requesters to maximize efficiency.