Pooling Database Connections with RDS Proxy
This lesson explains how RDS Proxy, a managed connection pool, protects RDS and Aurora databases from connection storms and makes failover faster.
Learning outcomes
After completing this lesson, you will be able to:
- Describe what RDS Proxy does.
- Explain how applications connect through the proxy endpoint.
What RDS Proxy does
Relational databases allow a limited number of connections, and each connection consumes memory. Applications that open many short-lived connections, such as Lambda functions, can exhaust that limit. RDS Proxy sits between applications and the database, pooling and reusing connections so that many clients share a small number of database connections.
During a failover, the proxy holds client connections open and redirects them to the new primary, which cuts failover time for applications by up to 66%. It can enforce IAM authentication for clients, while the database credentials are held in AWS Secrets Manager, so applications store no passwords. The proxy is highly available across Availability Zones and is reachable only from within the VPC.
The following diagram shows many functions sharing a small pool of connections.

What RDS Proxy gives
Using it
Applications use RDS Proxy by connecting to the proxy's endpoint instead of the database endpoint, with no other code changes. Read-only proxy endpoints route connections to read replicas, so reads can also benefit from pooling.
RDS Proxy is charged per vCPU of the underlying database instance, or per Aurora capacity unit for Aurora Serverless. It supports the MySQL, PostgreSQL, MariaDB and SQL Server engines on both Amazon RDS and Aurora.
Lambda exhausting database connections
A serverless API on Lambda writes to Aurora PostgreSQL. During a sale, 800 concurrent functions each open a connection, and the database rejects new connections.
| Fix | Effect |
|---|---|
| Put RDS Proxy between Lambda and Aurora | Hundreds of function connections share a small pool of database connections |
| Authenticate to the proxy with IAM | No database password in the functions |
| Open the connection outside the handler | Each environment reuses its connection |
During an Aurora failover, the proxy also keeps the functions' connections open and redirects them to the new writer, so the API sees a short pause rather than errors.
How does RDS Proxy shorten failover for applications?
Show answer
Applications stay connected to the proxy, which redirects to the new primary, so they do not have to wait for DNS changes.
Exam Tips
Remember for the exam
- When Lambda overwhelms the database with connections, use RDS Proxy.
- To reduce application downtime during RDS failover, use RDS Proxy.
- To make applications authenticate with IAM rather than database passwords, use RDS Proxy with IAM authentication.