RDS Failover / Multi-AZ Event Playbook
RDS primary failover, connection drops, DNS propagation lag, and replication issues. Multi-AZ failovers cause 1-3 minutes of downtime that cascades through every service with a database connection. This playbook covers detection, connection recovery, and preventing data loss during failover events.
Operator's Field Notes
Jeremy Martinez · Incident Commander | Principal Site Reliability Engineer
"RDS Multi-AZ failovers are supposed to be transparent. In practice, they cause 60-120 seconds of connection drops that break every application that doesn't handle database reconnection properly. The failover itself is usually fine - it's the connection pool behavior that kills you."
"The most common scenario: AWS performs maintenance, triggers a failover, the standby becomes primary. Your app's connection pool is still holding connections to the old primary. Those connections are dead but the pool doesn't know it. Every query fails until the pool refreshes. If your pool doesn't have validation queries or connection timeout settings, you're looking at 5-10 minutes of errors, not 60 seconds."
"First thing to check: RDS Events in the console. It will tell you exactly what happened and when. Second: check if your connection string uses the RDS endpoint (CNAME) or a raw IP. If someone hardcoded the IP, failover will never work."
RDS FAILOVER SYMPTOM MATRIX
Direct Symptoms
- • Connection refused / timeout to database
- • RDS event:
Multi-AZ failover complete - • DNS CNAME now resolves to different IP
- •
FATAL: connection reset by peer - • Read replica lag spike to hours
- • CloudWatch:
DatabaseConnectionsdrops to zero
Indirect Symptoms
- • Application 500 errors across all services
- • Health checks failing (DB-dependent)
- • Queue consumers stalling
- • Stale data in read-heavy services
- • Connection pool exhaustion errors
- • ORM-specific errors (ActiveRecord, SQLAlchemy, etc.)
First 5 Minutes - Triage
1. Check RDS Events
# Check recent RDS events aws rds describe-events --source-type db-instance \ --source-identifier mydb-production --duration 60 # Look for: # "Multi-AZ instance failover started" # "Multi-AZ instance failover complete" # "DB instance restarted" # "Applying maintenance to DB instance"
2. Verify Endpoint Resolution
# Check DNS resolution of RDS endpoint dig +short mydb-production.abc123.us-east-1.rds.amazonaws.com # Compare with the current primary's IP aws rds describe-db-instances --db-instance-identifier mydb-production \ --query 'DBInstances[].Endpoint' # If using direct IP (anti-pattern), update immediately # Check application connection strings for hardcoded IPs
3. Check Connection Pool Health
# Test connectivity from application subnet psql -h mydb-production.abc123.us-east-1.rds.amazonaws.com -U admin -d mydb -c "SELECT 1" # Check application connection pool metrics # Most ORMs expose pool stats: # - Active connections # - Idle connections # - Waiting threads # - Failed checkout attempts # Force connection pool refresh (app-specific) # Rails: ActiveRecord::Base.connection_pool.disconnect! # Spring Boot: HikariCP will auto-recover with connectionTestQuery # Node.js pg: pool.end() then recreate
Recovery Procedures
Application-Side Recovery
# Most effective: Rolling restart of application instances # This forces all connection pools to re-establish # ECS aws ecs update-service --cluster prod --service myapp --force-new-deployment # Kubernetes kubectl rollout restart deployment/myapp -n production # EC2 / Auto Scaling - cycle instances # Or: Hit the health check endpoint to trigger pool refresh
Read Replica Lag Recovery
# Check replication status aws rds describe-db-instances --db-instance-identifier mydb-read-1 \ --query 'DBInstances[].StatusInfos' # Check replica lag (CloudWatch) aws cloudwatch get-metric-statistics --namespace AWS/RDS \ --metric-name ReplicaLag --dimensions Name=DBInstanceIdentifier,Value=mydb-read-1 \ --start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \ --end-time $(date -u +%Y-%m-%dT%H:%M:%S) --period 60 --statistics Maximum # If replica lag is growing: the replica may need to be rebooted # WARNING: Rebooting a replica causes it to re-sync from scratch aws rds reboot-db-instance --db-instance-identifier mydb-read-1
Connection Pool Configuration (Prevention)
# HikariCP (Java/Spring Boot) - recommended settings
spring.datasource.hikari.connection-timeout=5000
spring.datasource.hikari.validation-timeout=3000
spring.datasource.hikari.connection-test-query=SELECT 1
spring.datasource.hikari.max-lifetime=600000
spring.datasource.hikari.idle-timeout=300000
# SQLAlchemy (Python)
engine = create_engine(url,
pool_pre_ping=True, # Validate connections before use
pool_recycle=300, # Recycle connections every 5 min
pool_timeout=5, # Fail fast on checkout
connect_args={"connect_timeout": 5}
)
# Node.js pg pool
const pool = new Pool({
connectionTimeoutMillis: 5000,
idleTimeoutMillis: 30000,
max: 20,
// Add connection validation
allowExitOnIdle: true
})Prevention & Hardening
Connection Resilience
- • Always use RDS endpoint, never raw IPs
- • Configure connection validation (pool_pre_ping)
- • Set aggressive connection timeouts (5s)
- • Implement retry logic with exponential backoff
- • Use RDS Proxy for connection pooling at scale
Monitoring
- • CloudWatch alarm on RDS failover events
- • ReplicaLag alarm (threshold: 30s)
- • DatabaseConnections sudden drop alert
- • Application-side DB error rate monitoring
- • DNS TTL monitoring on RDS endpoints
Anti-Patterns
❌ Don't Do This
- • Hardcoding database IPs in connection strings
- • No connection pool validation/test queries
- • Infinite connection timeout (wait forever)
- • Single-AZ RDS for production
- • Ignoring RDS maintenance windows
✅ Do This Instead
- • Use RDS endpoints exclusively
- • Enable pool_pre_ping or connectionTestQuery
- • 5-second connect timeout, 3 retries
- • Multi-AZ with automated failover
- • Schedule maintenance during low-traffic windows
Communication Templates
Initial Status Update
INCIDENT: RDS Multi-AZ Failover
SEVERITY: SEV-1
STATUS: Active - Recovery in progress
IMPACT: All services dependent on [database name] experienced connection
failures starting at [time]. Duration: approximately [X] minutes.
CAUSE: RDS Multi-AZ failover event triggered by [maintenance/hardware issue/manual].
Primary database switched from [AZ-a] to [AZ-b].
ACTIONS IN PROGRESS:
- Application connection pools being refreshed via rolling restart
- Read replica lag being monitored (current: [X] seconds)
- Verifying data consistency post-failover
NEXT UPDATE: 10 minutes