RDS `CPUUtilization` is pinned at 100% and the API is timing out.
AdvancedTroubleshootingRDS, Aurora and DynamoDB
Answer
Likely causes → One or a few bad queries: a missing index after a deploy, a plan regression from stale statistics, a runaway report, or lock contention that shows up as CPU spin.
Diagnose →
aws pi get-resource-metrics --service-type RDS --identifier db-ABCDEFGH123 \
--metric-queries '[{"Metric":"db.load.avg","GroupBy":{"Group":"db.sql_tokenized","Limit":5}}]' \
--start-time $(date -u -d '-1 hour' +%FT%TZ) --end-time $(date -u +%FT%TZ) --period-in-seconds 300
psql -c "select pid, now()-query_start dur, state, left(query,80) from pg_stat_activity where state<>'idle' order by dur desc limit 10;"
Fix →
- Kill the runaway query:
select pg_cancel_backend(<pid>); - Add the missing index (
CREATE INDEX CONCURRENTLY), and runANALYZEon the affected tables - Scale up only as a stopgap
Prevent → Keep Performance Insights and pg_stat_statements on, review query plans in CI for hot paths, and alarm on DB load above the vCPU count.
More on RDS, Aurora and DynamoDB
The app cannot connect to RDS: `psql: error: connection to server at "mydb.abc.us-east-1.rds.amazonaws.com" (10.0.3.12), port 5432 failed: Connection timed out`.Beginner`FATAL: password authentication failed for user "postgres"` and nobody knows the master password.Beginner`FATAL: no pg_hba.conf entry for host "10.0.1.25", user "app", database "orders", no encryption`.IntermediateApp logs show `FATAL: remaining connection slots are reserved for non-replication superuser connections` (or MySQL `ERROR 1040 (HY000): Too many connections`).IntermediateRDS status shows `storage-full` and writes fail.IntermediateA read replica's `ReplicaLag` keeps growing and reports show stale data.Intermediate