📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials AWS Solutions Architect RDS Proxy

RDS Proxy

4 min read Quiz at the end
Use RDS Proxy for Lambda-to-RDS connection pooling. Understand when proxy is required and how it improves failover handling.

RDS Proxy — Connection Pooling for Serverless

RDS Proxy is a managed database proxy that pools and shares database connections between application instances. It is especially valuable for serverless applications (Lambda) that open many short-lived connections to RDS.

Teacher Note: Every Lambda invocation opens a new database connection. With 1,000 concurrent Lambda invocations, you have 1,000 simultaneous database connections. MySQL has a max_connections limit — often 200-500 for smaller instances. RDS Proxy keeps a pool of 50 real connections and shares them among all 1,000 Lambda functions.

The Problem Without RDS Proxy

Without RDS Proxy:
  1,000 Lambda invocations --> 1,000 DB connections
  RDS max_connections = 200
  Result: 800 Lambda functions get 'Too many connections' error

With RDS Proxy:
  1,000 Lambda invocations --> RDS Proxy
  RDS Proxy maintains 50 DB connections
  Proxy multiplexes 1,000 app connections over 50 DB connections
  Result: All Lambda functions successfully query the database

RDS Proxy Features

  • Connection pooling: reduces database connection overhead significantly
  • Faster failover: during Multi-AZ failover, proxy reconnects in 30s vs 60-120s without proxy
  • IAM authentication: applications authenticate to proxy via IAM — no database passwords in code
  • Secrets Manager integration: proxy retrieves DB credentials from Secrets Manager automatically
  • Read/write splitting: proxy automatically routes read queries to read replicas

When to Use RDS Proxy

  • Lambda + RDS: always use RDS Proxy for Lambda functions connecting to RDS
  • ECS with many tasks: high concurrency can exhaust database connections
  • Auto-scaling applications: connection count spikes with application scale-out
  • NOT needed for: EC2 with connection pool in application code, RDS with pgBouncer
Exam Tip: RDS Proxy is not free — it costs approximately $0.015/vCPU/hour. However, the cost is often justified by eliminating connection errors during traffic spikes. For Lambda workloads, RDS Proxy almost always pays for itself in reliability improvements.