What is RDS Proxy and why would you use it with Lambda?
RDS Proxy sits between your application and the database and pools connections. It stops many short-lived Lambda functions from opening thousands of connections that exhaust the database, and it speeds up failover handling.
Explain it simply
A database is a small tea stall with only a few seats. If a thousand Lambda customers rush in each wanting their own seat, the stall collapses. RDS Proxy is a helper at the door who keeps a fixed set of seats in use and lets customers share them one after another.
Example
Without a proxy
1000 concurrent Lambda executions -> up to 1000 new DB connections
-> "too many connections" errors, high CPU on the database
With RDS Proxy
1000 Lambda executions -> proxy -> small warm pool of DB connections
-> database load stays steady
Other benefits
- credentials kept in Secrets Manager
- IAM authentication for connections
- faster failover: proxy keeps client connections and reconnects
to the new primaryEach database engine has a connection limit tied to its memory. Lambda scales out quickly, and each environment may hold its own connection, so spikes are a common cause of outages.
RDS Proxy supports MySQL and PostgreSQL engines on RDS and Aurora. It adds a small latency and has its own cost, so use it when connection counts are a real problem, not by default.
What to say in the interview
"RDS Proxy pools and reuses database connections, so bursty Lambda traffic does not overload the database, and it also smooths failovers. I use it for serverless apps on MySQL or PostgreSQL where connection count is the bottleneck."
Common mistakes
- Opening a new database connection inside the handler for every request.