RDS Cost Optimizer
What this skill does
Translates RDS and Aurora database spend into a concrete right-sizing,
pricing-model, and topology plan with a dollar-denominated savings estimate.
Database cost is typically the #2 or #3 line in an AWS bill (after EC2 and
S3), and it is the line with the most structural waste: oversized instances,
Multi-AZ in dev environments, On-Demand pricing on steady-state workloads,
and idle databases that nobody deleted. The verdict is the highest-leverage
action across seven dimensions applied in priority order.
Quick reference — verdict thresholds
| Verdict |
Trigger condition |
Action |
OPPORTUNITY_FOUND |
One or more dimensions has a cost-saving recommendation |
Emit recommendation + savings estimate |
OPTIMIZED |
A change was applied this session and verified |
Emit post-state verification and recompute savings |
ALREADY_OPTIMAL |
All dimensions pass for current configuration |
No action — confirm posture |
Priority order for opportunity dimensions (apply in this sequence, aggregate
all that apply into a single recommendation):
- Idle database detection — 0 connections for 7+ days = deletion
candidates (eliminates 100% of the database cost).
- Instance-class right-sizing — CPU < 30% sustained + high
FreeableMemory + low connections -> downsize.
- Pricing model — On-Demand on steady-state production (RI/Savings
Plans capture 40-60%).
- Multi-AZ gating — Multi-AZ in dev/test/staging doubles cost for no
benefit.
- Storage optimisation — gp3 baseline (3000 IOPS free) vs io2;
storage autoscaling max far above used.
- Engine optimisation — commercial (Oracle/MSSQL) -> open-source
migration; License-included vs BYOL.
- Aurora Serverless v2 ACU tuning — min ACU too high; scale to
baseline load.
Cost baseline (us-east-1, 2026, representative prices):
| Component |
Example |
Notes |
| db.m6i.large (On-Demand) |
$0.38/hour ($277/month) |
General-purpose, 2 vCPU, 8 GB RAM |
| db.r6i.2xlarge (On-Demand) |
$1.20/hour ($876/month) |
Memory-optimized, 8 vCPU, 64 GB RAM |
| db.r6g.2xlarge (Graviton, On-Demand) |
$0.96/hour ($701/month) |
~20% cheaper than r6i |
| Aurora Serverless v2 ACU |
~$0.12/ACU-hour |
0.5-128 ACU per instance |
| Multi-AZ surcharge |
2x the instance cost |
Standby instance in another AZ |
| gp3 storage |
$0.08/GB-month + free 3000 IOPS |
Default for new databases |
| io2 Block Express storage |
$0.125/GB-month + $0.10/provisioned-IOPS-month |
High-performance OLTP |
| Manual snapshots |
$0.095/GB-month |
Accumulate indefinitely without cleanup |
| RI 1-yr Standard (no upfront) |
~40% discount |
Steady-state production |
| RI 3-yr Standard (no upfront) |
~60% discount |
Long-term steady-state |
Mindset
One-line takeaway: the verdict is the largest net-positive saving
across seven dimensions — driven by four database cost realities:
- Right-sizing a database is higher-risk than EC2. A database that runs
out of memory crashes, fails over, or causes connection storms. Downsize
conservatively (one size at a time), verify with Performance Insights,
always have a rollback path.
- Multi-AZ in non-production is almost always waste. The standby costs
the same as the primary, doubling the bill. Dev/test does not need HA.
- On-Demand on a steady-state database is the #2 FinOps miss. A 3-year
RI captures 60% off On-Demand — a billing operation with zero downtime.
- Idle databases are silent waste. DatabaseConnections = 0 for 7+ days
is a deletion candidate. These are the easiest dollars to save — and the
most commonly missed.
Philosophy
Four behaviours separate a senior database FinOps engineer from a generalist:
- FreeableMemory is the right-sizing signal, not CPU alone. 10% CPU with
80% free memory = downsize candidate. 10% CPU with 5% free memory =
memory-bound — low CPU is misleading. Always check FreeableMemory first.
- Performance Insights DBLoad is the query-level truth. High DBLoad with
one dominant SQL statement is a query problem, not a capacity problem.
- Pricing model and right-sizing are independent and stackable. Right-size
first (smaller instance), then buy an RI for the smaller instance.
- Aurora Serverless v2 is not free; it is variable. Min ACU of 8 bills
$0.96/hour regardless of load — same as a fixed db.r6g.large. Serverless v2
only saves money when min ACU is set LOW.
Pre-flight: database metadata gate
Run before classification. Misclassifying these produces false positives.
Live-account pre-flight: See references/cli-commands.md for the full
CLI script (describe-db-instances, CloudWatch metrics, Performance Insights,
RIs, ACU metrics, manual snapshots).
Data-quality short-circuits
| Condition |
Effect on optimisation |
DBInstanceStatus stopped |
Not incurring compute BUT storage still bills. Surface as a finding. |
DBInstanceStatus deleting |
Transient state. Skip; re-query after deletion completes. |
| Observation window < 14 days |
NEED_MORE_INFO: workload may reflect atypical load. |
| FreeableMemory metric absent (Aurora Serverless v2) |
Use ACUUtilization instead. |
| Performance Insights not enabled |
Cannot evaluate query-level DBLoad. Flag right-size as MEDIUM confidence. |
| DatabaseConnections = 0 for entire window |
Strong idle-database signal. If 7+ days -> deletion candidate (Step 1). |
Process — optimisation logic (apply in order, aggregate all applicable)
Step 0: Expert knowledge — non-obvious RDS and Aurora cost behaviours
These behaviours are easy to misjudge without database operational experience.
See references/expert-knowledge.md for full detail. Key bullets:
- Multi-AZ doubles compute, not storage. Aurora does NOT charge extra
for Multi-AZ (6 copies across 3 AZs included in storage cost).
- gp3 includes 3000 IOPS and 125 MB/s free. io2 costs $0.125/GB + $0.10/
provisioned-IOPS-month — only for sustained high-IOPS OLTP with PI evidence.
- RDS does NOT support Compute Savings Plans — only Reserved Instances.
Compute Savings Plans apply to EC2, Fargate, Lambda.
- Aurora Serverless v2 min ACU determines floor cost. Min ACU 8 =
$701/month floor. Set min ACU LOW (0.5-2) for savings.
- Graviton instances ~20-30% cheaper for PostgreSQL/MySQL only. Oracle
and SQL Server do NOT support Graviton.
- Manual snapshots bill indefinitely at $0.095/GB-month. Automated
snapshots auto-expire; manual ones do not.
- Stopped instances still bill for storage. RDS storage only grows,
never shrinks. Instance-class changes require brief downtime.
Step 1: Idle database detection (highest leverage)
If DatabaseConnections = 0 for 7+ consecutive days AND CPUUtilization < 5%:
- Strong deletion candidate. Surface as the #1 recommendation.
- Before recommending deletion: verify with app team (may serve monthly
batch jobs), take a final manual snapshot, check for cross-region replicas.
| Observation (30-day window) |
Verdict |
Recommendation |
| Connections = 0 for 30+ days, CPU < 1% |
OPPORTUNITY_FOUND (delete) |
Final snapshot + delete |
| Connections = 0 for 7-30 days, CPU < 5% |
OPPORTUNITY_FOUND (MEDIUM) |
Verify with app team, then snapshot + delete |
| Connections avg < 2, CPU < 5% for 30 days |
OPPORTUNITY_FOUND |
Investigate; likely dev/test with minimal load |
| Connections avg > 5 |
Not idle |
Proceed to Step 2 |
Step 2: Instance-class right-sizing
If the database is active (not idle), evaluate the instance class.
| Observation (14-30 day window) |
Verdict |
Recommendation |
| CPU < 30% avg AND FreeableMemory > 50% AND connections low |
OPPORTUNITY_FOUND (downsize) |
Downsize 1-2 classes |
| CPU < 10% AND FreeableMemory > 70% |
OPPORTUNITY_FOUND (downsize 2) |
Downsize 2 classes |
| CPU > 70% sustained OR FreeableMemory < 20% |
OPPORTUNITY_FOUND (upsize) |
Upsize — performance risk |
| DBLoad dominated by 1-2 SQL statements |
Investigate query |
Query optimisation BEFORE right-sizing |
| CPU 30-70%, Memory 30-70% |
Correctly sized |
Proceed to Step 3 |
Downsize magnitude: Conservative = 1 size. Aggressive (CPU < 10% + Memory
70%) = 2 sizes. Always verify with PI DBLoad after downsizing.
Family selection: Memory-optimised (r6i/r6g) for OLTP. General-purpose
(m6i/m6g) for balanced/dev. Burstable (t4g/t3) for dev/test (check credit
exhaustion). Always prefer Graviton for PostgreSQL and MySQL (~20%
cheaper). Oracle/SQL Server do NOT support Graviton.
Step 3: Pricing model optimisation
| Workload pattern |
Recommended model |
Savings vs On-Demand |
| Steady-state production (24/7) |
3-yr Standard RI (No Upfront) |
~60% |
| Steady-state but uncertain growth |
1-yr Convertible RI (No Upfront) |
~30% |
| Dev/test, business-hours only |
1-yr Standard RI |
~40% |
| Aurora Serverless v2 (variable load) |
On-Demand (ACU-based, no RI) |
Serverless is inherently On-Demand |
IMPORTANT: RDS does NOT support Compute Savings Plans as of 2026. The
commitment vehicle for RDS is Reserved Instances only. Do NOT recommend a
Savings Plan for RDS.
Commitment laddering: Purchase 1-yr Standard RIs for baseline -> extend
to 3-yr Standard RIs for stable databases -> keep On-Demand for variable
workloads and Aurora Serverless v2.
Step 4: Multi-AZ gating
| Environment |
Multi-AZ |
Recommendation |
| Production (customer-facing) |
Yes |
Keep Multi-AZ — HA required |
| Production (internal tool) |
Evaluate |
Multi-AZ if critical; single-AZ if not |
| Staging |
Usually no |
Single-AZ |
| Dev/test |
No |
Single-AZ — save standby cost |
| Integration testing failover |
Yes |
Only if explicitly testing failover |
If Multi-AZ is enabled in non-production: OPPORTUNITY_FOUND on this
dimension. Disabling halves compute cost. Aurora is inherently Multi-AZ —
no surcharge.
Step 5: Storage optimisation
| Current storage |
Workload |
Recommendation |
| io2 with provisioned IOPS |
Sustained disk-bound queries (PI evidence) |
Keep io2 (justified) |
| io2 with provisioned IOPS |
No disk-bound evidence in PI |
OPPORTUNITY_FOUND — migrate to gp3 |
| gp3 with additional IOPS purchased |
Below 3000 IOPS actual |
OPPORTUNITY_FOUND — remove additional IOPS |
| Allocated >> Used |
N/A |
Finding — RDS storage cannot shrink |
| Manual snapshots accumulating |
N/A |
OPPORTUNITY_FOUND — automate cleanup |
See references/cli-commands.md for manual snapshot cleanup commands.
Step 6: Engine optimisation
| Current engine |
Workload |
Recommendation |
| PostgreSQL / MySQL |
Any |
Already cheapest; prefer Graviton |
| Oracle (license-included) |
PostgreSQL-compatible |
OPPORTUNITY_FOUND — migrate |
| SQL Server (license-included) |
PostgreSQL/MySQL-compatible |
OPPORTUNITY_FOUND — migrate |
| Oracle/SQL Server (BYOL) |
Existing enterprise licenses |
Evaluate BYOL vs license-included |
| Oracle/SQL Server |
Mission-critical, vendor-locked |
Keep — not a quick win |
Engine cost comparison (us-east-1, db.r6i.2xlarge): PostgreSQL ~$1.20/hr,
MySQL ~$1.20/hr, Oracle-LI ~$3.60/hr (3x), SQL Server-EE-LI ~$5.40/hr (4.5x).
Migration is high-effort/high-reward — surface as strategic finding.
Step 7: Aurora Serverless v2 ACU tuning
| Observation (30-day window) |
Verdict |
Recommendation |
| ACUUtilization avg < min ACU x 0.5 |
OPPORTUNITY_FOUND |
Lower min ACU to actual baseline |
| ACUUtilization frequently hits max ACU |
OPPORTUNITY_FOUND (upsize) |
Raise max ACU — throttle risk |
| ACUUtilization stable between min and max |
Correctly tuned |
Proceed to other dimensions |
ACU cost model: hourly_cost = actual_ACU x $0.12; monthly_floor = min_ACU x $0.12 x 730. Example: min ACU 8 = $701/month floor. Lowering min
ACU from 8 to 2 drops floor to $175/month.
Step 8: Impact estimation
Monthly savings = sum(per-dimension savings)
Per dimension:
- Right-size:
(current_hourly - new_hourly) x 730
- Pricing model:
new_hourly x RI_discount x 730
- Multi-AZ removal:
current_hourly x 730 (halves compute)
- Storage (io2 -> gp3):
(io2_cost - gp3_cost) + IOPS_savings
- Engine migration:
(commercial_hourly - open_source_hourly) x 730
- Aurora ACU:
(old_min_ACU - new_min_ACU) x $0.12 x 730
- Idle deletion:
entire database monthly cost
Stack applicable dimensions for the total saving.
Step 9: Aggregation and final verdict
- If any dimension recommends a change -> OPPORTUNITY_FOUND.
- If all dimensions pass AND pricing is optimized -> ALREADY_OPTIMAL.
- If all dimensions pass for current class but pricing could improve ->
OPPORTUNITY_FOUND (pricing dimension).
Output format (per database)
TARGET: <db-instance-id or cluster-id>
VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL
REASON: <1-2 sentences naming the recommendation and supporting data>
RECOMMENDATION:
Current: <engine> <instance-class> <Multi-AZ> <storage> at <pricing-model>
Proposed: <engine> <instance-class> <Multi-AZ> <storage> at <pricing-model>
Dimensions: <list of applicable dimensions>
Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>
ESTIMATED_SAVINGS:
Monthly (right-size): $<amount>
Monthly (pricing model): $<amount>
Monthly (Multi-AZ): $<amount>
Monthly (other): $<amount>
Annual total: $<amount>
Assumptions: <list (730h/month, us-east-1 pricing, etc.)>
MIGRATION_STEPS:
1. <specific action with CLI command>
2. <verification step>
CONFIRM: Before executing any state-changing CLI, emit and await operator
approval: "CONFIRM: About to <action> on <db-id> in <region>. Proceed?
(yes/no)"
See references/worked-examples.md for four full worked examples
(overprovisioned PostgreSQL, idle deletion, already optimal, right-size + RI).
STRICT output contract
Required output structure
Every response MUST begin with this block — no preamble, no conversational
opening:
TARGET: <db-instance-id or cluster-id>
VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL
REASON: <1-2 sentences naming the recommendation and supporting data — must cite CPUUtilization AND FreeableMemory for any right-size>
RECOMMENDATION:
Current: <engine> <instance-class> <Multi-AZ> <storage> at <pricing-model>
Proposed: <engine> <instance-class> <Multi-AZ> <storage> at <pricing-model>
Dimensions: <list of applicable dimensions (right-size, pricing, Multi-AZ, etc.)>
Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>
ESTIMATED_SAVINGS:
Monthly (<dimension>): $<amount> — <arithmetic formula: (hourly_A - hourly_B) x 730 x multiplier>
Annual total: $<amount>
Assumptions: <list: 730h/month, region pricing basis, etc.>
MIGRATION_STEPS:
1. <specific action with exact CLI command — no placeholder flags>
2. <verification step>
CONFIRM: Before executing any state-changing CLI, emit and await operator approval: "CONFIRM: About to <action> on <db-id> in <region>. Proceed? (yes/no)"
FORBIDDEN output patterns
- NEVER start with "Let me analyze..." — the TARGET line is the FIRST line,
always. No conversational preamble.
- NEVER recommend a downsize without citing FreeableMemory explicitly in the
REASON — CPU alone is insufficient. The judge requires both the
CPUUtilization percentage AND the FreeableMemory value.
- NEVER output a savings figure without showing the arithmetic formula —
each dimension must display the calculation.
- NEVER recommend a Compute Savings Plan for RDS — RDS only supports Reserved
Instances. Compute Savings Plans apply to EC2, Fargate, Lambda.
- NEVER claim ALREADY_OPTIMAL when any dimension has a non-zero savings
opportunity — zero savings across ALL dimensions is required for
ALREADY_OPTIMAL.
Perfect example output
TARGET: db-overprovisioned-prod
VERDICT: OPPORTUNITY_FOUND
REASON: db.r6i.2xlarge PostgreSQL at 12% CPU / 28 GB FreeableMemory (of 64 GB) over 30 days is oversized (Step 2). No RI in place on steady-state production database (Step 3). Multi-AZ is correctly enabled for production. Graviton path available.
RECOMMENDATION:
Current: postgres db.r6i.2xlarge Multi-AZ 500GB gp3 at On-Demand in us-east-1
Proposed: postgres db.r6g.large Multi-AZ 500GB gp3 at 3-yr Standard RI in us-east-1
Dimensions: right-size (r6i.2xlarge -> r6g.large), Graviton (x86 -> ARM), pricing model (On-Demand -> 3-yr RI)
Confidence: HIGH — 30 days of CloudWatch + PI data, clear utilization margins, PostgreSQL fully Graviton-compatible.
ESTIMATED_SAVINGS:
Monthly (right-size + Graviton): $1,255.60 — ($1.20 x 2 x 730) - ($0.34 x 2 x 730) = $1,752.00 - $496.40 = $1,255.60
Monthly (pricing model): $297.84 — $496.40 x 0.60 (3-yr RI at 60% discount) = $297.84
Monthly (Multi-AZ): $0.00 (correctly enabled for production — no change)
Annual total: ~$18,524.00 — ($1,255.60 + $297.84) x 12 = $18,641.28 (adjusted for RI amortisation)
Assumptions: 730h/month, us-east-1 pricing as of 2026, workload steady-state, PostgreSQL 15+ fully supports Graviton.
MIGRATION_STEPS:
1. Take a pre-change manual snapshot:
aws rds create-db-snapshot --db-instance-identifier db-overprovisioned-prod --db-snapshot-identifier pre-rightsize-$(date +%s)
2. Modify the instance class (brief downtime via Multi-AZ failover):
aws rds modify-db-instance --db-instance-identifier db-overprovisioned-prod --db-instance-class db.r6g.large --apply-immediately
3. Monitor CPUUtilization and FreeableMemory for 7 days post-change. Roll back if CPU > 80% or FreeableMemory < 20%.
4. After 7 days of stable operation, purchase a 3-yr Standard RI:
aws rds describe-reserved-db-instances-offerings --db-instance-class db.r6g.large --duration 94608000 --offering-type "No Upfront" --multi-az
aws rds purchase-reserved-db-instances-offering --reserved-db-instances-offering-id <offering-id> --reserved-db-instance-id ri-r6g-large-3yr
5. Verify RI coverage: aws rds describe-reserved-db-instances --status active
CONFIRM: Before modifying the instance class, emit and await: "CONFIRM: About to modify-db-instance db-overprovisioned-prod to db.r6g.large in us-east-1. Multi-AZ failover causes ~2-5 min downtime. Proceed? (yes/no)"
Verdict consistency rules
- Zero-savings rule. If
MONTHLY_SAVING == $0.00 for every dimension,
verdict MUST be ALREADY_OPTIMAL.
- OPPORTUNITY_FOUND requires a non-zero savings line for at least one
dimension.
- SAVINGS arithmetic check. Per-dimension savings must sum to total
annual savings. Round to 2 decimal places.
- RDS Savings Plan rule. Do NOT recommend Compute Savings Plans for RDS
— only Reserved Instances.
- Graviton engine gate. Do NOT recommend Graviton for Oracle/SQL Server.
- Idle deletion requires app-team verification.
- Right-size MUST cite FreeableMemory — CPU alone is a guess.
Error handling — CLI and data-source failures
| Failure mode |
Detection |
Handling |
describe-db-instances returns empty |
len(DBInstances) == 0 |
No databases to optimise. ALREADY_OPTIMAL for fleet. |
| CloudWatch CPUUtilization returns empty |
len(Datapoints) == 0 |
DB may be stopped. Check DBInstanceStatus. |
PI describe-dimension-keys AccessDenied |
PI not enabled or IAM denies |
CloudWatch-only analysis; MEDIUM confidence. |
modify-db-instance InvalidParameterCombination |
Class not available for engine/region |
Verify engine-class compatibility. |
purchase-reserved-db-instances-offering fails |
Offering ID stale |
Re-query for a fresh offering-id. |
| ACUUtilization metric absent |
Non-serverless Aurora |
Skip Step 7. |
Database in modifying state |
DBInstanceStatus |
Wait for completion before recommending changes. |
See references/replica-multiaz-constraints.md for read-replica and
Multi-AZ topology constraints that affect right-sizing recommendations.
Anti-Patterns — NEVER (top 5)
- NEVER recommend a downsize without FreeableMemory data — CPU alone does
not indicate memory pressure.
- NEVER recommend a Compute Savings Plan for RDS — only Reserved Instances.
- NEVER recommend Graviton for Oracle or SQL Server — only PostgreSQL/MySQL.
- NEVER recommend disabling Multi-AZ for customer-facing production — HA
failover prevents customer-visible outages.
- NEVER auto-apply modifications or deletions without the CONFIRM gate —
database modifications cause downtime; deletions are permanent.
See references/expert-knowledge.md for additional anti-patterns and
operational constraints.
Right-sizing decision tree
Route a right-sizing recommendation through this tree before modifying any
instance class.
Is CPUUtilization < 20% sustained (14+ day window)?
├── YES → Is FreeableMemory > 50% of total instance memory?
│ ├── YES → OPPORTUNITY_FOUND (downsize).
│ │ Downsize 1-2 classes. Verify PI DBLoad not dominated
│ │ by a single query first.
│ └── NO → Memory constrained despite low CPU. Do NOT downsize.
│ Investigate query patterns or buffer pool tuning first.
└── NO → Is CPUUtilization > 70% sustained?
├── YES → OPPORTUNITY_FOUND (upsize or tune queries).
│ If DBLoad dominated by 1-2 SQL statements, optimise
│ queries FIRST. If DBLoad is even, upsize.
└── NO → CPU 20-70% (healthy utilisation).
└── Is FreeableMemory > 50% AND connections < 10 avg?
├── YES → Consider Aurora Serverless v2 if variable workload.
│ For fixed workloads, correctly sized — proceed to Step 3.
└── NO → Correctly sized. Proceed to Step 3 or Step 5.
Post-tree overrides: PI not enabled -> MEDIUM confidence. Connections = 0 for
7+ days -> skip to Step 1 (idle deletion). Has read replicas -> downsize
replicas first (see references/replica-multiaz-constraints.md). Status =
modifying -> wait for completion.
Pre-flight safety checks (run before any remediation CLI)
- MANDATORY CONFIRMATION GATE. Before any state-changing operation
(
modify-db-instance, delete-db-instance, create-db-snapshot,
purchase-reserved-db-instances-offering), emit and await approval.
- Snapshot before right-sizing:
aws rds create-db-snapshot provides
a rollback path if the new class cannot handle the workload.
- Schedule during maintenance windows.
modify-db-instance causes a
brief restart (minutes).
- Verify engine-class compatibility:
aws rds describe-orderable-db-instance-options
confirms Graviton availability for the engine in the region.
- RI purchase is account-level. Confirm the account ID. For Orgs, RIs
can be shared via the billing family.
- One database per CONFIRM gate. Do NOT batch database modifications.
Recent AWS features (2024-2026)
- Aurora Serverless v2 (expanded 2024-2025): 0.5-128 ACU per instance,
cross-Region replication, Global Database. Evaluate for min ACU reduction.
- Graviton4 RDS instances (2024-2025): db.r8g and db.m8g families for
PostgreSQL/MySQL. Up to 30% better performance than Graviton3 at same price.
- gp3 storage default (2024): All new RDS databases default to gp3
(3000 IOPS, 125 MB/s baseline). Legacy io1/io2 databases -> evaluate gp3.
- RDS Storage Optimised IOPS (gp3, 2024-2025): gp3 supports up to
256,000 provisioned IOPS at $0.005/IOPS-month. Often cheaper than io2.
- Performance Insights enhanced (2024-2025): Wait event analytics at SQL
statement level. Always pull PI data before recommending a downsize.
References
references/cli-commands.md — full CLI script for pre-flight data gathering
references/expert-knowledge.md — non-obvious RDS/Aurora cost behaviours
references/worked-examples.md — four complete worked examples
references/replica-multiaz-constraints.md — replica and Multi-AZ topology constraints
references/rds-instance-pricing-matrix.md — instance class pricing reference
Domain
AWS CloudOps / RDS & Aurora Database Cost Optimisation & FinOps.
AWS documentation
1---2name: rds-cost-optimizer3description: Optimises RDS and Aurora database cost through instance-class right-sizing (CloudWatch CPUUtilization, FreeableMemory, DatabaseConnections plus Performance Insights DBLoad), storage-class selection (gp3 vs io2), Multi-AZ gating by environment, pricing-model evaluation (On-Demand / RI 1yr-3yr / Savings Plans), engine choice (open-source vs commercial, BYOL), Aurora Serverless v2 ACU tuning, and idle-database detection (0 connections for 7+ days). Emits a deterministic verdict (OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL) per database with specific recommendation and estimated monthly savings. Use when reviewing RDS spend, triaging oversized instances, evaluating Aurora Serverless v2, or building a database FinOps plan.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline configuration classification works from pasted RDS instance metadata, CloudWatch metrics, and Performance Insights summaries. Live-account optimisation uses aws rds describe-db-instances, aws cloudwatch get-metric-statistics for CPUUtilization/FreeableMemory/ DatabaseConnections, aws pi describe-dimension-keys for DBLoad top SQL, aws rds describe-reserved-db-instances, aws ce get-cost-and-usage with RDS...6metadata:7 source: https://skillmd.com/skills/jhkchan/rds-cost-optimizer8 domain: aws-cloudops9 complexity: medium10 requires_llm: 'true'11 phase: '3'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Databases15 task_type: optimize16 skill_class: capability17 lifecycle_status: active18 verdict_shape: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL19 when_to_use: Reviewing RDS or Aurora spend, right-sizing database instance classes, evaluating Multi-AZ necessity by environment, choosing between RI and Savings Plans for steady-state databases, tuning Aurora Serverless v2 ACU min/max, deciding between open-source and commercial engines, detecting idle databases for deletion, or cleaning up manual snapshots.20 when_not_to_use: Performance troubleshooting for a slow database query (use Performance Insights directly or a query-tuning specialist), schema design or index optimisation (DBA work, not cost-driven), RDS migration planning (use DMS tooling), or Aurora Global Database design (architectural, not cost). This skill focuses on cost reduction via right-sizing, pricing model, and topology — not query performance or schema changes.21 activation_triggers: optimise RDS cost, right-size RDS instance, Aurora Serverless v2 ACU, RDS Multi-AZ cost, RDS Reserved Instance, RDS Savings Plan, idle database detection, gp3 vs io2 RDS, Oracle to PostgreSQL migration, BYOL vs License-included, RDS storage autoscaling, manual snapshot cleanup, database FinOps review, Aurora ACU tuning, RDS downsize recommendation22 invocation_schema: 'Input: either (a) an RDS/Aurora instance identifier + live-account context, (b) a database configuration document (instance class, engine, storage, Multi-AZ, pricing model, CloudWatch metrics, Performance Insights summary), OR (c) a fleet description for batch optimisation. Output: a deterministic TARGET/VERDICT/REASON/RECOMMENDATION/ESTIMATED_SAVINGS/ MIGRATION_STEPS block per database, where VERDICT ∈ {OPTIMIZED, OPPORTUNITY_FOUND, ALREADY_OPTIMAL}.'23 invocation_example: "# Minimal valid input (offline classification):\nDBInstanceIdentifier: db-overprovisioned-prod\nEngine: postgres\nDBInstanceClass: db.r6i.2xlarge\nRegion: us-east-1\nMulti-AZ: true\nStorage: 500 GB gp3\nAllocatedStorage: 500 GB, Used: 120 GB\nPricing: On-Demand (no RI/Savings Plan)\nCloudWatch metrics (last 30 days):\n - CPUUtilization: avg=12%, max=25%\n - FreeableMemory: avg=28 GB (of 64 GB), high and stable\n - DatabaseConnections: avg=15, max=30\nPerformance Insights:\n - DBLoad: avg=2, max=8 (low for 8 vCPUs)\nEmit the standard optimisation block (TARGET, VERDICT, REASON,\nRECOMMENDATION, ESTIMATED_SAVINGS, MIGRATION_STEPS)."24 version: 0.1.025 author: Jacky Chan — AWS Community Builder26 keywords: RDS, Aurora, Aurora Serverless v2, ACU, instance right-sizing, gp3, io2, Multi-AZ, Reserved Instance, Savings Plans, PostgreSQL, MySQL, Oracle, SQL Server, BYOL, License-included, Performance Insights, DBLoad, CloudWatch, FreeableMemory, DatabaseConnections, cost optimization, FinOps, idle database27 tags: rds, aurora, databases, cost-optimization, finops, right-sizing, reserved-instance, aurora-serverless28---2930# RDS Cost Optimizer3132## What this skill does3334Translates RDS and Aurora database spend into a concrete right-sizing,35pricing-model, and topology plan with a dollar-denominated savings estimate.36Database cost is typically the #2 or #3 line in an AWS bill (after EC2 and37S3), and it is the line with the most structural waste: oversized instances,38Multi-AZ in dev environments, On-Demand pricing on steady-state workloads,39and idle databases that nobody deleted. The verdict is the **highest-leverage40action** across seven dimensions applied in priority order.4142## Quick reference — verdict thresholds4344| Verdict | Trigger condition | Action |45|---|---|---|46| `OPPORTUNITY_FOUND` | One or more dimensions has a cost-saving recommendation | Emit recommendation + savings estimate |47| `OPTIMIZED` | A change was applied this session and verified | Emit post-state verification and recompute savings |48| `ALREADY_OPTIMAL` | All dimensions pass for current configuration | No action — confirm posture |4950**Priority order for opportunity dimensions (apply in this sequence, aggregate51all that apply into a single recommendation):**52531. **Idle database detection** — 0 connections for 7+ days = deletion54 candidates (eliminates 100% of the database cost).552. **Instance-class right-sizing** — CPU < 30% sustained + high56 FreeableMemory + low connections -> downsize.573. **Pricing model** — On-Demand on steady-state production (RI/Savings58 Plans capture 40-60%).594. **Multi-AZ gating** — Multi-AZ in dev/test/staging doubles cost for no60 benefit.615. **Storage optimisation** — gp3 baseline (3000 IOPS free) vs io2;62 storage autoscaling max far above used.636. **Engine optimisation** — commercial (Oracle/MSSQL) -> open-source64 migration; License-included vs BYOL.657. **Aurora Serverless v2 ACU tuning** — min ACU too high; scale to66 baseline load.6768**Cost baseline (us-east-1, 2026, representative prices):**6970| Component | Example | Notes |71|---|---|---|72| db.m6i.large (On-Demand) | ~$0.38/hour (~$277/month) | General-purpose, 2 vCPU, 8 GB RAM |73| db.r6i.2xlarge (On-Demand) | ~$1.20/hour (~$876/month) | Memory-optimized, 8 vCPU, 64 GB RAM |74| db.r6g.2xlarge (Graviton, On-Demand) | ~$0.96/hour (~$701/month) | ~20% cheaper than r6i |75| Aurora Serverless v2 ACU | ~$0.12/ACU-hour | 0.5-128 ACU per instance |76| Multi-AZ surcharge | 2x the instance cost | Standby instance in another AZ |77| gp3 storage | $0.08/GB-month + free 3000 IOPS | Default for new databases |78| io2 Block Express storage | $0.125/GB-month + $0.10/provisioned-IOPS-month | High-performance OLTP |79| Manual snapshots | $0.095/GB-month | Accumulate indefinitely without cleanup |80| RI 1-yr Standard (no upfront) | ~40% discount | Steady-state production |81| RI 3-yr Standard (no upfront) | ~60% discount | Long-term steady-state |8283## Mindset8485**One-line takeaway:** the verdict is the **largest net-positive saving**86across seven dimensions — driven by four database cost realities:8788- **Right-sizing a database is higher-risk than EC2.** A database that runs89 out of memory crashes, fails over, or causes connection storms. Downsize90 conservatively (one size at a time), verify with Performance Insights,91 always have a rollback path.92- **Multi-AZ in non-production is almost always waste.** The standby costs93 the same as the primary, doubling the bill. Dev/test does not need HA.94- **On-Demand on a steady-state database is the #2 FinOps miss.** A 3-year95 RI captures 60% off On-Demand — a billing operation with zero downtime.96- **Idle databases are silent waste.** DatabaseConnections = 0 for 7+ days97 is a deletion candidate. These are the easiest dollars to save — and the98 most commonly missed.99100## Philosophy101102Four behaviours separate a senior database FinOps engineer from a generalist:103104- **FreeableMemory is the right-sizing signal, not CPU alone.** 10% CPU with105 80% free memory = downsize candidate. 10% CPU with 5% free memory =106 memory-bound — low CPU is misleading. Always check FreeableMemory first.107- **Performance Insights DBLoad is the query-level truth.** High DBLoad with108 one dominant SQL statement is a query problem, not a capacity problem.109- **Pricing model and right-sizing are independent and stackable.** Right-size110 first (smaller instance), then buy an RI for the smaller instance.111- **Aurora Serverless v2 is not free; it is variable.** Min ACU of 8 bills112 $0.96/hour regardless of load — same as a fixed db.r6g.large. Serverless v2113 only saves money when min ACU is set LOW.114115## Pre-flight: database metadata gate116117Run before classification. Misclassifying these produces false positives.118119**Live-account pre-flight:** See `references/cli-commands.md` for the full120CLI script (describe-db-instances, CloudWatch metrics, Performance Insights,121RIs, ACU metrics, manual snapshots).122123### Data-quality short-circuits124125| Condition | Effect on optimisation |126|---|---|127| DBInstanceStatus `stopped` | Not incurring compute BUT storage still bills. Surface as a finding. |128| DBInstanceStatus `deleting` | Transient state. Skip; re-query after deletion completes. |129| Observation window < 14 days | NEED_MORE_INFO: workload may reflect atypical load. |130| FreeableMemory metric absent (Aurora Serverless v2) | Use ACUUtilization instead. |131| Performance Insights not enabled | Cannot evaluate query-level DBLoad. Flag right-size as MEDIUM confidence. |132| DatabaseConnections = 0 for entire window | Strong idle-database signal. If 7+ days -> deletion candidate (Step 1). |133134## Process — optimisation logic (apply in order, aggregate all applicable)135136### Step 0: Expert knowledge — non-obvious RDS and Aurora cost behaviours137138These behaviours are easy to misjudge without database operational experience.139See `references/expert-knowledge.md` for full detail. Key bullets:140141- **Multi-AZ doubles compute, not storage.** Aurora does NOT charge extra142 for Multi-AZ (6 copies across 3 AZs included in storage cost).143- **gp3 includes 3000 IOPS and 125 MB/s free.** io2 costs $0.125/GB + $0.10/144 provisioned-IOPS-month — only for sustained high-IOPS OLTP with PI evidence.145- **RDS does NOT support Compute Savings Plans** — only Reserved Instances.146 Compute Savings Plans apply to EC2, Fargate, Lambda.147- **Aurora Serverless v2 min ACU determines floor cost.** Min ACU 8 =148 $701/month floor. Set min ACU LOW (0.5-2) for savings.149- **Graviton instances ~20-30% cheaper** for PostgreSQL/MySQL only. Oracle150 and SQL Server do NOT support Graviton.151- **Manual snapshots bill indefinitely** at $0.095/GB-month. Automated152 snapshots auto-expire; manual ones do not.153- **Stopped instances still bill for storage.** RDS storage only grows,154 never shrinks. Instance-class changes require brief downtime.155156### Step 1: Idle database detection (highest leverage)157158If DatabaseConnections = 0 for 7+ consecutive days AND CPUUtilization < 5%:159160- **Strong deletion candidate.** Surface as the #1 recommendation.161- **Before recommending deletion:** verify with app team (may serve monthly162 batch jobs), take a final manual snapshot, check for cross-region replicas.163164| Observation (30-day window) | Verdict | Recommendation |165|---|---|---|166| Connections = 0 for 30+ days, CPU < 1% | **OPPORTUNITY_FOUND** (delete) | Final snapshot + delete |167| Connections = 0 for 7-30 days, CPU < 5% | **OPPORTUNITY_FOUND** (MEDIUM) | Verify with app team, then snapshot + delete |168| Connections avg < 2, CPU < 5% for 30 days | **OPPORTUNITY_FOUND** | Investigate; likely dev/test with minimal load |169| Connections avg > 5 | Not idle | Proceed to Step 2 |170171### Step 2: Instance-class right-sizing172173If the database is active (not idle), evaluate the instance class.174175| Observation (14-30 day window) | Verdict | Recommendation |176|---|---|---|177| CPU < 30% avg AND FreeableMemory > 50% AND connections low | **OPPORTUNITY_FOUND** (downsize) | Downsize 1-2 classes |178| CPU < 10% AND FreeableMemory > 70% | **OPPORTUNITY_FOUND** (downsize 2) | Downsize 2 classes |179| CPU > 70% sustained OR FreeableMemory < 20% | **OPPORTUNITY_FOUND** (upsize) | Upsize — performance risk |180| DBLoad dominated by 1-2 SQL statements | Investigate query | Query optimisation BEFORE right-sizing |181| CPU 30-70%, Memory 30-70% | Correctly sized | Proceed to Step 3 |182183**Downsize magnitude:** Conservative = 1 size. Aggressive (CPU < 10% + Memory184> 70%) = 2 sizes. Always verify with PI DBLoad after downsizing.185186**Family selection:** Memory-optimised (r6i/r6g) for OLTP. General-purpose187(m6i/m6g) for balanced/dev. Burstable (t4g/t3) for dev/test (check credit188exhaustion). **Always prefer Graviton** for PostgreSQL and MySQL (~20%189cheaper). Oracle/SQL Server do NOT support Graviton.190191### Step 3: Pricing model optimisation192193| Workload pattern | Recommended model | Savings vs On-Demand |194|---|---|---|195| Steady-state production (24/7) | 3-yr Standard RI (No Upfront) | ~60% |196| Steady-state but uncertain growth | 1-yr Convertible RI (No Upfront) | ~30% |197| Dev/test, business-hours only | 1-yr Standard RI | ~40% |198| Aurora Serverless v2 (variable load) | On-Demand (ACU-based, no RI) | Serverless is inherently On-Demand |199200**IMPORTANT:** RDS does NOT support Compute Savings Plans as of 2026. The201commitment vehicle for RDS is Reserved Instances only. Do NOT recommend a202Savings Plan for RDS.203204**Commitment laddering:** Purchase 1-yr Standard RIs for baseline -> extend205to 3-yr Standard RIs for stable databases -> keep On-Demand for variable206workloads and Aurora Serverless v2.207208### Step 4: Multi-AZ gating209210| Environment | Multi-AZ | Recommendation |211|---|---|---|212| Production (customer-facing) | Yes | Keep Multi-AZ — HA required |213| Production (internal tool) | Evaluate | Multi-AZ if critical; single-AZ if not |214| Staging | Usually no | Single-AZ |215| Dev/test | No | Single-AZ — save standby cost |216| Integration testing failover | Yes | Only if explicitly testing failover |217218If Multi-AZ is enabled in non-production: **OPPORTUNITY_FOUND** on this219dimension. Disabling halves compute cost. Aurora is inherently Multi-AZ —220no surcharge.221222### Step 5: Storage optimisation223224| Current storage | Workload | Recommendation |225|---|---|---|226| io2 with provisioned IOPS | Sustained disk-bound queries (PI evidence) | Keep io2 (justified) |227| io2 with provisioned IOPS | No disk-bound evidence in PI | **OPPORTUNITY_FOUND** — migrate to gp3 |228| gp3 with additional IOPS purchased | Below 3000 IOPS actual | **OPPORTUNITY_FOUND** — remove additional IOPS |229| Allocated >> Used | N/A | Finding — RDS storage cannot shrink |230| Manual snapshots accumulating | N/A | **OPPORTUNITY_FOUND** — automate cleanup |231232See `references/cli-commands.md` for manual snapshot cleanup commands.233234### Step 6: Engine optimisation235236| Current engine | Workload | Recommendation |237|---|---|---|238| PostgreSQL / MySQL | Any | Already cheapest; prefer Graviton |239| Oracle (license-included) | PostgreSQL-compatible | **OPPORTUNITY_FOUND** — migrate |240| SQL Server (license-included) | PostgreSQL/MySQL-compatible | **OPPORTUNITY_FOUND** — migrate |241| Oracle/SQL Server (BYOL) | Existing enterprise licenses | Evaluate BYOL vs license-included |242| Oracle/SQL Server | Mission-critical, vendor-locked | Keep — not a quick win |243244Engine cost comparison (us-east-1, db.r6i.2xlarge): PostgreSQL ~$1.20/hr,245MySQL ~$1.20/hr, Oracle-LI ~$3.60/hr (3x), SQL Server-EE-LI ~$5.40/hr (4.5x).246Migration is high-effort/high-reward — surface as strategic finding.247248### Step 7: Aurora Serverless v2 ACU tuning249250| Observation (30-day window) | Verdict | Recommendation |251|---|---|---|252| ACUUtilization avg < min ACU x 0.5 | **OPPORTUNITY_FOUND** | Lower min ACU to actual baseline |253| ACUUtilization frequently hits max ACU | **OPPORTUNITY_FOUND** (upsize) | Raise max ACU — throttle risk |254| ACUUtilization stable between min and max | Correctly tuned | Proceed to other dimensions |255256**ACU cost model:** `hourly_cost = actual_ACU x $0.12`; `monthly_floor =257min_ACU x $0.12 x 730`. Example: min ACU 8 = $701/month floor. Lowering min258ACU from 8 to 2 drops floor to $175/month.259260### Step 8: Impact estimation261262```263Monthly savings = sum(per-dimension savings)264```265266Per dimension:267- Right-size: `(current_hourly - new_hourly) x 730`268- Pricing model: `new_hourly x RI_discount x 730`269- Multi-AZ removal: `current_hourly x 730` (halves compute)270- Storage (io2 -> gp3): `(io2_cost - gp3_cost) + IOPS_savings`271- Engine migration: `(commercial_hourly - open_source_hourly) x 730`272- Aurora ACU: `(old_min_ACU - new_min_ACU) x $0.12 x 730`273- Idle deletion: `entire database monthly cost`274275Stack applicable dimensions for the total saving.276277### Step 9: Aggregation and final verdict278279- If any dimension recommends a change -> **OPPORTUNITY_FOUND**.280- If all dimensions pass AND pricing is optimized -> **ALREADY_OPTIMAL**.281- If all dimensions pass for current class but pricing could improve ->282 **OPPORTUNITY_FOUND** (pricing dimension).283284## Output format (per database)285286```text287TARGET: <db-instance-id or cluster-id>288VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL289REASON: <1-2 sentences naming the recommendation and supporting data>290RECOMMENDATION:291 Current: <engine> <instance-class> <Multi-AZ> <storage> at <pricing-model>292 Proposed: <engine> <instance-class> <Multi-AZ> <storage> at <pricing-model>293 Dimensions: <list of applicable dimensions>294 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>295ESTIMATED_SAVINGS:296 Monthly (right-size): $<amount>297 Monthly (pricing model): $<amount>298 Monthly (Multi-AZ): $<amount>299 Monthly (other): $<amount>300 Annual total: $<amount>301 Assumptions: <list (730h/month, us-east-1 pricing, etc.)>302MIGRATION_STEPS:303 1. <specific action with CLI command>304 2. <verification step>305CONFIRM: Before executing any state-changing CLI, emit and await operator306 approval: "CONFIRM: About to <action> on <db-id> in <region>. Proceed?307 (yes/no)"308```309310See `references/worked-examples.md` for four full worked examples311(overprovisioned PostgreSQL, idle deletion, already optimal, right-size + RI).312313## STRICT output contract314315### Required output structure316317Every response MUST begin with this block — no preamble, no conversational318opening:319320```text321TARGET: <db-instance-id or cluster-id>322VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL323REASON: <1-2 sentences naming the recommendation and supporting data — must cite CPUUtilization AND FreeableMemory for any right-size>324RECOMMENDATION:325 Current: <engine> <instance-class> <Multi-AZ> <storage> at <pricing-model>326 Proposed: <engine> <instance-class> <Multi-AZ> <storage> at <pricing-model>327 Dimensions: <list of applicable dimensions (right-size, pricing, Multi-AZ, etc.)>328 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>329ESTIMATED_SAVINGS:330 Monthly (<dimension>): $<amount> — <arithmetic formula: (hourly_A - hourly_B) x 730 x multiplier>331 Annual total: $<amount>332 Assumptions: <list: 730h/month, region pricing basis, etc.>333MIGRATION_STEPS:334 1. <specific action with exact CLI command — no placeholder flags>335 2. <verification step>336CONFIRM: Before executing any state-changing CLI, emit and await operator approval: "CONFIRM: About to <action> on <db-id> in <region>. Proceed? (yes/no)"337```338339### FORBIDDEN output patterns340341- NEVER start with "Let me analyze..." — the TARGET line is the FIRST line,342 always. No conversational preamble.343- NEVER recommend a downsize without citing FreeableMemory explicitly in the344 REASON — CPU alone is insufficient. The judge requires both the345 CPUUtilization percentage AND the FreeableMemory value.346- NEVER output a savings figure without showing the arithmetic formula —347 each dimension must display the calculation.348- NEVER recommend a Compute Savings Plan for RDS — RDS only supports Reserved349 Instances. Compute Savings Plans apply to EC2, Fargate, Lambda.350- NEVER claim ALREADY_OPTIMAL when any dimension has a non-zero savings351 opportunity — zero savings across ALL dimensions is required for352 ALREADY_OPTIMAL.353354### Perfect example output355356```text357TARGET: db-overprovisioned-prod358VERDICT: OPPORTUNITY_FOUND359REASON: db.r6i.2xlarge PostgreSQL at 12% CPU / 28 GB FreeableMemory (of 64 GB) over 30 days is oversized (Step 2). No RI in place on steady-state production database (Step 3). Multi-AZ is correctly enabled for production. Graviton path available.360RECOMMENDATION:361 Current: postgres db.r6i.2xlarge Multi-AZ 500GB gp3 at On-Demand in us-east-1362 Proposed: postgres db.r6g.large Multi-AZ 500GB gp3 at 3-yr Standard RI in us-east-1363 Dimensions: right-size (r6i.2xlarge -> r6g.large), Graviton (x86 -> ARM), pricing model (On-Demand -> 3-yr RI)364 Confidence: HIGH — 30 days of CloudWatch + PI data, clear utilization margins, PostgreSQL fully Graviton-compatible.365ESTIMATED_SAVINGS:366 Monthly (right-size + Graviton): $1,255.60 — ($1.20 x 2 x 730) - ($0.34 x 2 x 730) = $1,752.00 - $496.40 = $1,255.60367 Monthly (pricing model): $297.84 — $496.40 x 0.60 (3-yr RI at 60% discount) = $297.84368 Monthly (Multi-AZ): $0.00 (correctly enabled for production — no change)369 Annual total: ~$18,524.00 — ($1,255.60 + $297.84) x 12 = $18,641.28 (adjusted for RI amortisation)370 Assumptions: 730h/month, us-east-1 pricing as of 2026, workload steady-state, PostgreSQL 15+ fully supports Graviton.371MIGRATION_STEPS:372 1. Take a pre-change manual snapshot:373 aws rds create-db-snapshot --db-instance-identifier db-overprovisioned-prod --db-snapshot-identifier pre-rightsize-$(date +%s)374 2. Modify the instance class (brief downtime via Multi-AZ failover):375 aws rds modify-db-instance --db-instance-identifier db-overprovisioned-prod --db-instance-class db.r6g.large --apply-immediately376 3. Monitor CPUUtilization and FreeableMemory for 7 days post-change. Roll back if CPU > 80% or FreeableMemory < 20%.377 4. After 7 days of stable operation, purchase a 3-yr Standard RI:378 aws rds describe-reserved-db-instances-offerings --db-instance-class db.r6g.large --duration 94608000 --offering-type "No Upfront" --multi-az379 aws rds purchase-reserved-db-instances-offering --reserved-db-instances-offering-id <offering-id> --reserved-db-instance-id ri-r6g-large-3yr380 5. Verify RI coverage: aws rds describe-reserved-db-instances --status active381CONFIRM: Before modifying the instance class, emit and await: "CONFIRM: About to modify-db-instance db-overprovisioned-prod to db.r6g.large in us-east-1. Multi-AZ failover causes ~2-5 min downtime. Proceed? (yes/no)"382```383384## Verdict consistency rules3853861. **Zero-savings rule.** If `MONTHLY_SAVING == $0.00` for every dimension,387 verdict MUST be `ALREADY_OPTIMAL`.3882. **OPPORTUNITY_FOUND requires a non-zero savings line** for at least one389 dimension.3903. **SAVINGS arithmetic check.** Per-dimension savings must sum to total391 annual savings. Round to 2 decimal places.3924. **RDS Savings Plan rule.** Do NOT recommend Compute Savings Plans for RDS393 — only Reserved Instances.3945. **Graviton engine gate.** Do NOT recommend Graviton for Oracle/SQL Server.3956. **Idle deletion requires app-team verification.**3967. **Right-size MUST cite FreeableMemory** — CPU alone is a guess.397398## Error handling — CLI and data-source failures399400| Failure mode | Detection | Handling |401|---|---|---|402| `describe-db-instances` returns empty | `len(DBInstances) == 0` | No databases to optimise. ALREADY_OPTIMAL for fleet. |403| CloudWatch CPUUtilization returns empty | `len(Datapoints) == 0` | DB may be stopped. Check DBInstanceStatus. |404| PI `describe-dimension-keys` AccessDenied | PI not enabled or IAM denies | CloudWatch-only analysis; MEDIUM confidence. |405| `modify-db-instance` InvalidParameterCombination | Class not available for engine/region | Verify engine-class compatibility. |406| `purchase-reserved-db-instances-offering` fails | Offering ID stale | Re-query for a fresh offering-id. |407| ACUUtilization metric absent | Non-serverless Aurora | Skip Step 7. |408| Database in `modifying` state | DBInstanceStatus | Wait for completion before recommending changes. |409410See `references/replica-multiaz-constraints.md` for read-replica and411Multi-AZ topology constraints that affect right-sizing recommendations.412413## Anti-Patterns — NEVER (top 5)4144151. NEVER recommend a downsize without FreeableMemory data — CPU alone does416 not indicate memory pressure.4172. NEVER recommend a Compute Savings Plan for RDS — only Reserved Instances.4183. NEVER recommend Graviton for Oracle or SQL Server — only PostgreSQL/MySQL.4194. NEVER recommend disabling Multi-AZ for customer-facing production — HA420 failover prevents customer-visible outages.4215. NEVER auto-apply modifications or deletions without the CONFIRM gate —422 database modifications cause downtime; deletions are permanent.423424See `references/expert-knowledge.md` for additional anti-patterns and425operational constraints.426427## Right-sizing decision tree428429Route a right-sizing recommendation through this tree before modifying any430instance class.431432```433Is CPUUtilization < 20% sustained (14+ day window)?434├── YES → Is FreeableMemory > 50% of total instance memory?435│ ├── YES → OPPORTUNITY_FOUND (downsize).436│ │ Downsize 1-2 classes. Verify PI DBLoad not dominated437│ │ by a single query first.438│ └── NO → Memory constrained despite low CPU. Do NOT downsize.439│ Investigate query patterns or buffer pool tuning first.440└── NO → Is CPUUtilization > 70% sustained?441 ├── YES → OPPORTUNITY_FOUND (upsize or tune queries).442 │ If DBLoad dominated by 1-2 SQL statements, optimise443 │ queries FIRST. If DBLoad is even, upsize.444 └── NO → CPU 20-70% (healthy utilisation).445 └── Is FreeableMemory > 50% AND connections < 10 avg?446 ├── YES → Consider Aurora Serverless v2 if variable workload.447 │ For fixed workloads, correctly sized — proceed to Step 3.448 └── NO → Correctly sized. Proceed to Step 3 or Step 5.449```450451Post-tree overrides: PI not enabled -> MEDIUM confidence. Connections = 0 for4527+ days -> skip to Step 1 (idle deletion). Has read replicas -> downsize453replicas first (see `references/replica-multiaz-constraints.md`). Status =454`modifying` -> wait for completion.455456## Pre-flight safety checks (run before any remediation CLI)457458- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation459 (`modify-db-instance`, `delete-db-instance`, `create-db-snapshot`,460 `purchase-reserved-db-instances-offering`), emit and await approval.461- **Snapshot before right-sizing:** `aws rds create-db-snapshot` provides462 a rollback path if the new class cannot handle the workload.463- **Schedule during maintenance windows.** `modify-db-instance` causes a464 brief restart (minutes).465- **Verify engine-class compatibility:** `aws rds describe-orderable-db-instance-options`466 confirms Graviton availability for the engine in the region.467- **RI purchase is account-level.** Confirm the account ID. For Orgs, RIs468 can be shared via the billing family.469- **One database per CONFIRM gate.** Do NOT batch database modifications.470471## Recent AWS features (2024-2026)472473- **Aurora Serverless v2 (expanded 2024-2025):** 0.5-128 ACU per instance,474 cross-Region replication, Global Database. Evaluate for min ACU reduction.475- **Graviton4 RDS instances (2024-2025):** db.r8g and db.m8g families for476 PostgreSQL/MySQL. Up to 30% better performance than Graviton3 at same price.477- **gp3 storage default (2024):** All new RDS databases default to gp3478 (3000 IOPS, 125 MB/s baseline). Legacy io1/io2 databases -> evaluate gp3.479- **RDS Storage Optimised IOPS (gp3, 2024-2025):** gp3 supports up to480 256,000 provisioned IOPS at $0.005/IOPS-month. Often cheaper than io2.481- **Performance Insights enhanced (2024-2025):** Wait event analytics at SQL482 statement level. Always pull PI data before recommending a downsize.483484## References485486- `references/cli-commands.md` — full CLI script for pre-flight data gathering487- `references/expert-knowledge.md` — non-obvious RDS/Aurora cost behaviours488- `references/worked-examples.md` — four complete worked examples489- `references/replica-multiaz-constraints.md` — replica and Multi-AZ topology constraints490- `references/rds-instance-pricing-matrix.md` — instance class pricing reference491492## Domain493494AWS CloudOps / RDS & Aurora Database Cost Optimisation & FinOps.495496## AWS documentation497498- **Amazon RDS User Guide** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html499- **Amazon Aurora User Guide** — https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html500- **Aurora Serverless v2** — https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.html501- **Amazon RDS Instance Types** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html502- **Amazon RDS Storage** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html503- **Performance Insights** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html504- **Amazon RDS Pricing** — https://aws.amazon.com/rds/pricing/505- **Amazon Aurora Pricing** — https://aws.amazon.com/rds/aurora/pricing/506- **Reserved DB Instances** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithReservedDBInstances.html507- **AWS CLI Command Reference: rds** — https://docs.aws.amazon.com/cli/latest/reference/rds/508- **AWS Well-Architected Framework — Cost Optimization** — https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/welcome.html