ElastiCache Cost Optimizer
What this skill does
Optimises Amazon ElastiCache cost across seven dimensions: node-type
right-sizing, Graviton-based node migration, Reserved Node evaluation,
replication group topology, ElastiCache Serverless fit, persistence
cost, and data tiering. Emits a deterministic verdict per cluster with
estimated monthly savings and a one-dimension-per-window migration plan.
STRICT output contract
Every invocation MUST emit exactly one optimisation block per cluster
in this shape — no prose before, no commentary after:
TARGET: <replication-group-id or cache-cluster-id>
VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL
REASON: <1-2 sentences naming the recommendation and supporting data>
RECOMMENDATION:
Current: <engine, node-type, shard count, replicas, persistence,
pricing model, data tiering>
Proposed: <per-dimension list of changes>
Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>
ESTIMATED_SAVINGS:
Monthly (right-sizing): $<amount>
Monthly (Graviton migration): $<amount>
Monthly (reserved node): $<amount>
Monthly (topology): $<amount>
Monthly (serverless fit): $<amount>
Monthly (persistence): $<amount>
Monthly (data tiering): $<amount>
Annual total: $<amount>
Assumptions: <pricing region, 730h/month, 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 <cluster>. Proceed? (yes/no)"
A block missing VERDICT, RECOMMENDATION, ESTIMATED_SAVINGS, or
MIGRATION_STEPS is a contract violation — re-emit the full block.
Quick start
- Graviton-based nodes (cache.r6g/r7g) are ~20% cheaper than the
equivalent cache.m5/r5 generation and are the single highest-leverage
migration for ElastiCache. Same vCPU and memory, same Redis/Memcached
engine; the price drop is architectural. A cluster on
cache.m5.2xlarge
($0.832/h) migrates to cache.r6g.2xlarge ($0.664/h) for ~20% off
with no application change. The r7g generation is cheaper still.
- EngineCPUUtilization, not CPUUtilization, is the right Redis metric
for right-sizing. CPUUtilization includes the OS overhead; the Redis
engine's own CPU (EngineCPUUtilization) is the real constraint. A node
with avg EngineCPUUtilization < 20% has significant headroom for
downsize. For Memcached (multi-AZ, multi-threaded), CPUUtilization is
the correct metric because the engine uses all cores.
- ElastiCache Serverless (2024+) eliminates node management and auto-
scales capacity. It bills per-GB-hour of data plus per-vCPU-hour of
compute. Workloads with variable load or overnight idle periods can
save 30-60% vs provisioned nodes that sit idle. Steady-state workloads
on large nodes are usually cheaper provisioned.
- Reserved Nodes are ElastiCache's biggest commit lever for steady-
state clusters. A 1-yr no-upfront RN on
cache.r6g.2xlarge yields
~40% discount vs On-Demand; a 3-yr is ~60%. RNs are engine-flexible
within the same family (Redis OSS RN applies to any Redis OSS node of
that class) but NOT cross-engine (Redis RN does not cover Memcached).
- Fewer larger nodes are usually cheaper than many small nodes. Six
cache.r6g.large (6 × $0.167/h = $1.002/h) cost more than three
cache.r6g.2xlarge (3 × $0.334/h = $1.002/h) at parity, but the
smaller nodes add operational overhead. The cost breaks even at 2:1
ratios; beyond that, fewer larger nodes win on per-node overhead.
Mindset
ElastiCache cost structure differs from databases in three ways: there
is no per-I/O charge (all operations are bundled into the node-hour),
memory is the primary capacity constraint (not CPU), and replication
doubles or triples the node cost (each replica is a full node). The
levers are Graviton generation, node size, replica count, persistence
mode, and RN commits. Most ElastiCache waste comes from (a) legacy
cache.m5/r5 nodes that should be Graviton, (b) over-replicated clusters
with more replicas than the read throughput requires, or (c) AOF
persistence enabled on a cache that doesn't need durability.
Quick reference — verdict thresholds
| Observation |
Verdict |
Dimension |
| Cluster on cache.m5/r5/c4 (pre-Graviton) |
OPPORTUNITY_FOUND |
Graviton migration |
| EngineCPUUtilization avg < 20% on cache.r6g.2xlarge+ |
OPPORTUNITY_FOUND |
Right-sizing |
| CurrConnections avg < 50 with EngineCPU < 10% |
OPPORTUNITY_FOUND |
Right-sizing or removal |
| Cluster On-Demand, steady > 6 months, no RN |
OPPORTUNITY_FOUND |
Reserved Node |
| ReplicasPerShard > 1 with read QPS < single-node capacity |
OPPORTUNITY_FOUND |
Topology |
| AOF persistence on a cache with RDB backup elsewhere |
OPPORTUNITY_FOUND |
Persistence |
| Dataset > 60% of node memory with cold keys |
OPPORTUNITY_FOUND |
Data tiering |
| Variable load, overnight idle > 50% of hours, provisioned |
OPPORTUNITY_FOUND |
Serverless fit |
| All seven dimensions at cost-optimal config |
ALREADY_OPTIMAL |
(continue monitoring) |
Pre-flight: data gate (run before any optimisation decision)
ElastiCache optimisation requires four data sources: Cost Explorer for
billing line items, cluster configuration (node types, shards,
replicas, persistence), CloudWatch metrics for utilisation, and the
reserved-node inventory.
Required data sources
CLI data-gathering commands (Cost Explorer, ElastiCache topology, CloudWatch) moved verbatim to references/diagnostic-commands.md.
Load on demand when running the live-account pre-flight data gate.
Data-quality short-circuits
Data-quality short-circuit table (window length, cluster states, Global Datastore, Serverless, Memcached) moved verbatim to references/diagnostic-commands.md.
Load on demand when validating observation windows and cluster states before emitting recommendations.
Process — Optimisation logic (apply in order)
Step 0: Non-obvious behaviours that change the recommendation
Step-0 deep dive on non-obvious ElastiCache cost behaviours (Graviton pricing, EngineCPU vs CPU, replica billing, AOF write amplification, Serverless billing model, RN size-flexibility, data tiering, cluster-mode cost) moved verbatim to references/advanced-patterns.md.
Load on demand before classifying a cluster — each behaviour changes the recommendation if ignored.
Step 1: Validate input and data sufficiency
If Cost Explorer access is unavailable AND the caller has not pasted
billing line items, emit NEED_MORE_INFO:
Full NEED_MORE_INFO output block moved verbatim to references/worked-examples.md.
Load on demand when the Cost Explorer data gate fails.
Step 2: Cost Explorer reconciliation
Cost Explorer reconciliation CLI (USAGE_TYPE breakdown) moved verbatim to references/diagnostic-commands.md.
Load on demand when quantifying per-dimension spend.
| USAGE_TYPE |
Dimension |
What it represents |
ElastiCache:NodeUsage |
Compute (provisioned) |
Per-node-hour by type |
ElastiCache:ServerlessUsage |
Compute (Serverless) |
Per-GB-hour + per-vCPU-hour |
ElastiCache:BackupUsage |
Snapshots |
Per-GB-month of backup storage |
If ElastiCache:NodeUsage dominates with nodes on m5/r5 generation, the
Graviton migration is the first lever. If ServerlessUsage is high with
steady load, the workload may be cheaper on provisioned nodes.
Step 3: Cost classification
| Cost profile |
Indicators |
Emphasis |
| Pre-Graviton |
cache.m5/r5/c4 nodes |
Graviton migration (Step 5) |
| Over-provisioned |
EngineCPU avg < 20%, low connections |
Right-sizing (Step 4) |
| Steady On-Demand |
No RN, uptime > 6 months |
Reserved Node (Step 8) |
| Over-replicated |
ReplicasPerShard > 1, low read QPS |
Topology (Step 7) |
| High persistence cost |
AOF enabled, high write volume |
Persistence (Step 9) |
| Large dataset, cold tail |
Memory > 60% full, inactive keys |
Data tiering (Step 10) |
| Variable load |
Overnight idle, spiky daytime |
Serverless fit (Step 6) |
| Mixed (no single dimension dominant) |
Even distribution |
Apply all in parallel |
Step 4: Node-type right-sizing
Decision matrix (Redis — use EngineCPUUtilization):
| EngineCPU profile (30-day) |
Recommendation |
Savings estimate |
| avg < 20%, max < 40% on cache.r6g.2xlarge |
Downsize to cache.r6g.xlarge |
~50% of compute |
| avg 20-50%, max < 70% |
Keep current size |
None |
| avg > 70% frequently |
Upsize or add shards |
None — already constrained |
| avg < 10%, CurrConnections < 50 |
Consider removal or serverless |
100% if removed |
Decision matrix (Memcached — use CPUUtilization):
| CPUUtilization profile (30-day) |
Recommendation |
Savings estimate |
| avg < 20%, max < 40% on cache.m6g.2xlarge |
Downsize one step |
~50% |
| avg 20-50% |
Keep current |
None |
| avg > 70% |
Upsize (Memcached uses all cores) |
None |
Worked example — Redis right-sizing:
Full worked example (6 × cache.r6g.2xlarge → xlarge, $1,445/month) moved verbatim to references/worked-examples.md.
Load on demand when right-sizing Redis nodes.
Step 5: Graviton-based node migration
This is the highest-leverage dimension when the cluster is on a pre-
Graviton generation.
| Current generation |
Target |
Savings |
Notes |
| cache.m5.large ($0.226/h) |
cache.r6g.large ($0.167/h) |
~26% |
Same 2 vCPU / 6.05 GB |
| cache.m5.2xlarge ($0.452/h) |
cache.r6g.2xlarge ($0.334/h) |
~26% |
Same 8 vCPU / 26.36 GB |
| cache.r5.large ($0.250/h) |
cache.r6g.large ($0.167/h) |
~33% |
r5 → r6g architectural drop |
| cache.r5.2xlarge ($0.500/h) |
cache.r6g.2xlarge ($0.334/h) |
~33% |
Same class upgrade |
| cache.r6g.large ($0.167/h) |
cache.r7g.large ($0.153/h) |
~8% |
Further Graviton gen |
| cache.c4.* (legacy) |
cache.r7g.* equivalent |
~35-40% |
c4 is oldest; large savings |
Worked example — Graviton migration:
Full worked example (m5.2xlarge → r6g.2xlarge, $517/month, 26%) moved verbatim to references/worked-examples.md.
Load on demand when evaluating Graviton migration.
Step 6: ElastiCache Serverless fit evaluation
Serverless eliminates node management and auto-scales. The break-even
calculation compares the provisioned node's effective utilisation
against the serverless per-GB-hour + per-vCPU-hour rate.
Break-even logic:
provisioned_monthly = node_count × node_hourly × 730
serverless_monthly = (data_GB × $0.00383/h × 730) +
(compute_vCPU_hours × $0.045/h × 730)
A rough heuristic: if the provisioned cluster sits below 30% average
utilisation (EngineCPU or connections), Serverless is likely cheaper.
If the cluster runs above 60% utilisation steady-state, provisioned
with an RN is cheaper.
| Provisioned utilisation |
Recommendation |
Rationale |
| avg < 20%, overnight idle > 50% |
Migrate to Serverless |
Pay only for data + compute used |
| avg 20-40%, spiky |
Evaluate Serverless; compare 30-day cost |
Break-even zone |
| avg > 40% steady |
Keep provisioned + RN |
Provisioned cheaper at steady load |
| Dataset > 100 GB with steady load |
Keep provisioned |
Serverless per-GB adds up at scale |
Worked example — Serverless migration:
Full worked example ($122/month provisioned → $18.39/month serverless, 85%) moved verbatim to references/worked-examples.md.
Load on demand when evaluating Serverless fit.
Step 7: Replication group topology
| Observation |
Recommendation |
Savings |
| ReplicasPerShard=2, read QPS < single-replica capacity |
Reduce to 1 replica per shard |
~33% of replica nodes |
| 3 shards, dataset fits in 1 large node |
Consolidate to 1 shard + 1 replica |
4 nodes eliminated |
| Non-cluster mode, dataset > single node memory |
Enable cluster mode (shard) |
None directly; prevents OOM |
| Cluster mode with 1 shard |
Revert to non-cluster (simpler, same cost) |
None (operational only) |
Worked example — replica reduction:
Full worked example (9 → 6 nodes, $366/month) moved verbatim to references/worked-examples.md.
Load on demand when reducing replica count.
Step 8: Reserved Node evaluation
Reserved Node offering query CLI moved verbatim to references/diagnostic-commands.md.
Load on demand when pricing an RN purchase.
| Pattern |
Recommendation |
Savings vs On-Demand |
| On-Demand, uptime > 6 months, steady load |
1-yr No Upfront RN |
~40% |
| On-Demand, uptime > 18 months, mission-critical |
3-yr No Upfront or Partial |
~60% |
| Burst-reader with spiky load |
Keep On-Demand |
None |
| Cluster scheduled for migration in < 6 months |
No RN (commit outlasts cluster) |
None |
| Existing RN on old node type (m5), migrating to r6g |
Exchange via modify-reserved-cache-nodes-offering |
Pro-rated exchange |
Reserved node exchange:
Reserved node exchange CLI and exchange rules moved verbatim to references/diagnostic-commands.md.
Load on demand when migrating node generations with an active RN.
Step 9: Persistence cost optimisation
| Observation |
Recommendation |
Savings |
| AOF enabled on ephemeral cache (rebuildable) |
Disable persistence |
Node performance tax eliminated |
| AOF on high-write cache |
Switch to RDB snapshots (daily) |
Reduces write amplification |
| RDB snapshots with 7-day retention on small dataset |
Reduce to 1-day or disable |
$0.023/GB-month backup savings |
| AOF + RDB both enabled |
Pick one; both is redundant |
AOF performance tax |
| Persistence on, but never restored from backup in 12 months |
Disable or reduce frequency |
Full persistence overhead |
Persistence deep dive (AOF vs RDB mechanics, when to disable persistence) moved verbatim to references/advanced-patterns.md.
Load on demand when auditing persistence cost (Step 9).
Step 10: Data tiering evaluation (r6gd/r7gd)
Data tiering automatically moves infrequently accessed items to SSD,
halving the effective per-GB cost for datasets with a cold tail.
| Observation |
Recommendation |
Savings |
| Dataset > 60% of node memory, > 50% keys inactive |
Migrate to r6gd/r7gd (tiered) |
~45% per-GB cost |
| Dataset < 30% of node memory |
Standard r6g/r7g (no tiering needed) |
None |
| All keys hot (no cold tail) |
Standard r6g/r7g (tiering adds overhead) |
None |
| Using 4+ nodes to hold a large dataset |
Consolidate to fewer r6gd nodes |
Node count reduction |
Worked example — data tiering:
Full worked example (6 × r6g.2xlarge → 3 × r7gd.4xlarge) moved verbatim to references/worked-examples.md.
Load on demand when evaluating data tiering (Step 10).
Step 11: Final verdict
The verdict is the worst-case (most-actionable) finding across all
seven dimensions:
- If ANY dimension has a concrete recommendation with quantified
savings, verdict is OPPORTUNITY_FOUND.
- If a change was applied and verified this session, verdict is
OPTIMIZED.
- If all dimensions are at cost-optimal config AND RN evaluation has
been considered, verdict is ALREADY_OPTIMAL.
Output format
Worked example — multi-dimension opportunity
TARGET: orders-cache-rg
VERDICT: OPPORTUNITY_FOUND
REASON: Cluster runs cache.m5.2xlarge (pre-Graviton) with
EngineCPUUtilization avg 12%, 3 shards x 2 nodes, AOF persistence
on an ephemeral cache, and no Reserved Node after 12 months
steady-state. Four dimensions have actionable opportunities.
RECOMMENDATION:
Current:
Nodes: 6 x cache.m5.2xlarge ($0.452/h each) = $1,980/month
Topology: 3 shards x 2 nodes (primary + 1 replica)
Persistence: AOF (append-only file)
Pricing: On-Demand (no RN)
Proposed:
- Graviton migration: cache.m5.2xlarge -> cache.r6g.2xlarge
($0.334/h, 26% cheaper). No application change.
- Right-sizing: EngineCPU avg 12% / max 25% on r6g.2xlarge ->
downsize to cache.r6g.xlarge ($0.334/h -> $0.167/h).
- Persistence: disable AOF (cache is rebuilt from RDS on restart;
persistence is redundant).
- RN: 1-yr No Upfront RN on cache.r6g.xlarge after migration settles.
Confidence: HIGH — CloudWatch confirms EngineCPU headroom; CE confirms
On-Demand spend with no RN discount applied.
ESTIMATED_SAVINGS:
Monthly (Graviton migration): $517 (6 x ($0.452-$0.334) x 730)
Monthly (right-sizing): $731 (6 x ($0.334-$0.167) x 730)
Monthly (persistence): $0 (no direct charge; performance tax)
Monthly (reserved node): $292 (40% off 6 x $0.167 x 730)
Monthly (topology): $0
Annual total: $18,480
Assumptions: us-east-1 pricing, 730h/month, Graviton + right-size
applied before RN purchase so RN matches the new node type.
MIGRATION_STEPS:
1. Snapshot the replication group before any change:
aws elasticache create-snapshot \
--cache-cluster-id orders-cache-rg-0001 \
--snapshot-name pre-opt-$(date +%s)
2. Create the new replication group on cache.r6g.xlarge:
aws elasticache create-replication-group \
--replication-group-id orders-cache-rg-v2 \
--replication-group-description "Orders cache r6g" \
--engine redis --cache-node-type cache.r6g.xlarge \
--num-cache-clusters 6
3. Sync data via application dual-write or ElastiCache DMS:
# Start dual-writing to both clusters; wait for sync to converge
4. Cut over the application endpoint to the new replication group.
5. Verify EngineCPUUtilization stays < 60% in 24h on the new nodes.
6. Disable AOF on the new group if not already:
aws elasticache modify-replication-group \
--replication-group-id orders-cache-rg-v2 \
--append-only no --apply-immediately
7. After 7 days stable, purchase RN:
aws elasticache purchase-reserved-cache-nodes-offering \
--reserved-cache-nodes-offering-id <offering-id> \
--reserved-cache-node-id orders-cache-rn-1yr \
--cache-node-count 6
8. Delete the old replication group after verification:
aws elasticache delete-replication-group \
--replication-group-id orders-cache-rg
CONFIRM: Before each state-changing CLI, emit and await operator
approval. Stage changes one dimension per window; never batch
the Graviton migration + right-size + RN purchase.
Worked example — already optimal
Full ALREADY_OPTIMAL worked example moved verbatim to references/worked-examples.md.
Load on demand when all seven dimensions pass.
Anti-Patterns — NEVER do these things
NEVER recommend Graviton migration without confirming engine
module compatibility. Redis modules (RedisJSON, RedisSearch,
RedisGraph) may have limited ARM support in older ElastiCache engine
versions. Verify the engine version supports all loaded modules on
Graviton before recommending migration.
NEVER recommend downsize based on CPUUtilization alone for Redis.
Redis is single-threaded for command processing; CPUUtilization (OS-
level) can look low while the Redis engine thread is saturated.
Always check EngineCPUUtilization before recommending a Redis node
downsize. For Memcached, CPUUtilization is correct.
NEVER recommend reducing replicas below 1 per shard for a
production Redis cluster. A single-node shard has no failover
target; if the primary fails, the shard is lost. Always retain at
least 1 replica for HA unless the cluster is explicitly non-critical.
NEVER recommend disabling AOF without confirming the cache's
rebuild strategy. If the application cannot rebuild the cache from
a primary database on restart (e.g., computed values with no source),
disabling persistence means a full cache warm-up cost on every
failover. Confirm the rebuild path before disabling.
NEVER recommend ElastiCache Serverless for a steady-state
workload above 60% utilisation without computing the break-even.
Serverless per-GB-hour + per-vCPU-hour pricing exceeds provisioned
node cost at high steady utilisation. Always compute the 30-day
projected Serverless cost and compare against the provisioned +
RN cost before recommending migration.
NEVER recommend a 3-year RN on a cluster with active migration plans.
The RN outlasts the cluster and the commitment is billed whether or
not the cluster exists. Match RN term to expected cluster lifetime.
NEVER recommend adding shards for cost savings — sharding is for
capacity or throughput, not cost. Each shard adds a full primary +
replicas.
NEVER exchange an RN via modify-reserved-cache-nodes-offering
without confirming the new offering's engine and node type match
the target cluster.
NEVER batch the Graviton migration + node right-size + RN purchase
in one maintenance window. Stack the changes one dimension per
window so any regression can be attributed to a specific change.
NEVER purchase a Memcached RN expecting size flexibility — Memcached
RNs are tied to the specific node type; only Redis OSS RNs are
size-flexible within a family.
Quick navigation
| You want to... |
Jump to |
| Evaluate Graviton migration (m5/r5 -> r6g/r7g) |
Step 5 — Graviton migration |
| Right-size cache nodes (Redis) |
Step 4 — Node right-sizing |
| Evaluate ElastiCache Serverless |
Step 6 — Serverless fit |
| Reduce replica count / topology |
Step 7 — Replication group topology |
| Decide on a Reserved Node |
Step 8 — RN evaluation |
| Audit AOF / RDB persistence |
Step 9 — Persistence cost |
| Evaluate data tiering (r6gd/r7gd) |
Step 10 — Data tiering |
| Handle missing data |
Step 1 — Validate input |
| Look up pricing / node types |
references/elasticache-pricing-reference.md |
Expert heuristic — the 60-second triage
The 60-second bill triage (six ordered checks mapping symptoms to steps) moved verbatim to references/advanced-patterns.md.
Load on demand when triaging an ElastiCache bill before deep-diving.
Pre-flight safety checks (run before any remediation CLI)
Verdict semantics
| Verdict |
When to emit |
Position in workflow |
OPPORTUNITY_FOUND |
At least one dimension has a savings-bearing recommendation. |
Primary — terminal for actionable findings. |
OPTIMIZED |
A change was applied and verified this session; CE line items confirm the new pattern. |
Primary — only emitted post-remediation. |
ALREADY_OPTIMAL |
All seven dimensions at cost-optimal config AND RN evaluation considered. |
Primary — terminal for healthy findings. |
NEED_MORE_INFO |
Data gate failed: CE access denied, CloudWatch window < 14 days. |
Pre-decision — emit per-dimension; other dimensions can still emit OPPORTUNITY_FOUND. |
Recent AWS features (2024-2026)
Recent AWS features (Serverless billing, r7g, data tiering, Redis 7.2+, Global Datastore, RN exchange) moved verbatim to references/advanced-patterns.md.
Load on demand when checking feature-dependent recommendations.
References (load on demand)
- references/worked-examples.md — secondary worked examples: NEED_MORE_INFO block, right-sizing, Graviton, Serverless, replica-reduction, data-tiering, and ALREADY_OPTIMAL.
- references/diagnostic-commands.md — pre-flight data-gathering CLI, data-quality short-circuits, Cost Explorer reconciliation, RN offering query and exchange.
- references/advanced-patterns.md — Step-0 non-obvious behaviours, persistence deep dive, 60-second bill triage, recent AWS features.
- references/elasticache-pricing-reference.md — node-type pricing lookup.
AWS documentation
Domain: AWS CloudOps / Databases — Amazon ElastiCache cost optimisation.
1---2name: elasticache-cost-optimizer3description: Optimises Amazon ElastiCache cost across seven dimensions — node-type right-sizing (CloudWatch EngineCPUUtilization, CPUUtilization, CurrConnections), Graviton node migration (cache.r6g/r7g ~20% cheaper than cache.m5/r5), Reserved Node vs On-Demand (1yr/3yr, modify-reserved-cache-nodes-offering exchange), replication group topology (fewer larger nodes vs many small, replica count, cluster mode sharding cost), ElastiCache Serverless (auto-scaling, per-GB-hour pricing), persistence cost (AOF vs RDB snapshots), and data tiering (r6gd/r7gd SSD-backed). Distinguishes Redis vs Memcached for cost. Covers latest Serverless, Graviton r7g, and data tiering. Emits OPTIMIZED, OPPORTUNITY_FOUND, or ALREADY_OPTIMAL per cluster with estimated monthly savings.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline classification works from pasted cluster configuration, CloudWatch summaries, and billing line items. Live-account optimisation uses aws elasticache describe-replication-groups, describe-cache-clusters --show-cache-node-info, describe-reserved-cache-nodes, describe-reserved-cache-nodes-offerings, aws cloudwatch get-metric-statistics for AWS/ElastiCache CPUUtilization, EngineCPUUtilization...6metadata:7 source: https://skillmd.com/skills/jhkchan/elasticache-cost-optimizer8 domain: aws-cloudops9 complexity: high10 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 Amazon ElastiCache cluster spend, right-sizing cache node types, evaluating Graviton-based nodes (cache.r6g/r7g vs cache.m5/r5), deciding between On-Demand and Reserved Nodes for steady-state cache clusters, tuning replication group topology (fewer larger nodes vs many small), evaluating ElastiCache Serverless for variable workloads, auditing AOF persistence cost, or evaluating data tiering (r6gd/r7gd) for large datasets.20 when_not_to_use: RDS or Aurora cost optimisation (use rds-cost-optimizer or aurora-cost-optimizer), DynamoDB capacity-mode optimisation (use a DynamoDB specialist), Redis self-managed on EC2 cost optimisation (this skill covers the managed ElastiCache service only), cache performance tuning or eviction policy tuning as the primary goal (use a cache operations workflow; this skill uses metrics only to identify cost waste), or ElastiCache failover operations (use elasticache-failover-operator).21 activation_triggers: optimise ElastiCache cost, right-size ElastiCache node, ElastiCache Graviton migration, cache.r6g vs cache.m5, ElastiCache Reserved Node, ElastiCache Serverless, replication group topology cost, ElastiCache cluster mode cost, AOF persistence cost, ElastiCache data tiering, cache node right-sizing, ElastiCache FinOps review, reduce ElastiCache bill, Memcached vs Redis cost22 invocation_schema: 'Input: either (a) an ElastiCache replication group or cache cluster identifier + live-account context, (b) a cluster configuration document (engine, node type, shard count, replicas per shard, persistence mode, pricing model, CloudWatch metrics), OR (c) a fleet description for batch optimisation. Output: a deterministic TARGET / VERDICT / REASON / RECOMMENDATION / ESTIMATED_SAVINGS / MIGRATION_STEPS block per cluster, where VERDICT ∈ {OPTIMIZED, OPPORTUNITY_FOUND, ALREADY_OPTIMAL}.'23 invocation_example: "# Minimal valid input (offline classification):\nReplication Group: orders-cache-rg\nEngine: redis (7.0)\nRegion: us-east-1\nNodeType: cache.m5.2xlarge (8 vCPU, 26.36 GB)\nShards: 3 (cluster mode enabled)\nReplicasPerShard: 1 (total 6 nodes)\nPersistence: RDB snapshots (daily)\nPricing: On-Demand (no RN)\nCloudWatch metrics (last 30 days):\n - CPUUtilization: avg=8%, max=15%\n - EngineCPUUtilization: avg=5%, max=12%\n - CurrConnections: avg=120, max=200\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: Amazon ElastiCache, ElastiCache for Redis, ElastiCache for Memcached, ElastiCache Serverless, Graviton, cache.r6g, cache.r7g, cache.r6gd, data tiering, Reserved Node, replication group, cluster mode, sharding, right-sizing, AOF persistence, RDB snapshots, FinOps, cache cost27 tags: elasticache, databases, cost-optimization, finops, right-sizing, serverless28---2930# ElastiCache Cost Optimizer3132## What this skill does3334Optimises Amazon ElastiCache cost across seven dimensions: node-type35right-sizing, Graviton-based node migration, Reserved Node evaluation,36replication group topology, ElastiCache Serverless fit, persistence37cost, and data tiering. Emits a deterministic verdict per cluster with38estimated monthly savings and a one-dimension-per-window migration plan.3940## STRICT output contract4142Every invocation MUST emit exactly one optimisation block per cluster43in this shape — no prose before, no commentary after:4445```text46TARGET: <replication-group-id or cache-cluster-id>47VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL48REASON: <1-2 sentences naming the recommendation and supporting data>49RECOMMENDATION:50 Current: <engine, node-type, shard count, replicas, persistence,51 pricing model, data tiering>52 Proposed: <per-dimension list of changes>53 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>54ESTIMATED_SAVINGS:55 Monthly (right-sizing): $<amount>56 Monthly (Graviton migration): $<amount>57 Monthly (reserved node): $<amount>58 Monthly (topology): $<amount>59 Monthly (serverless fit): $<amount>60 Monthly (persistence): $<amount>61 Monthly (data tiering): $<amount>62 Annual total: $<amount>63 Assumptions: <pricing region, 730h/month, etc.>64MIGRATION_STEPS:65 1. <specific action with CLI command>66 2. <verification step>67CONFIRM: Before executing any state-changing CLI, emit and await operator68 approval: "CONFIRM: About to <action> on <cluster>. Proceed? (yes/no)"69```7071A block missing VERDICT, RECOMMENDATION, ESTIMATED_SAVINGS, or72MIGRATION_STEPS is a contract violation — re-emit the full block.7374## Quick start7576- **Graviton-based nodes (cache.r6g/r7g) are ~20% cheaper than the77 equivalent cache.m5/r5 generation and are the single highest-leverage78 migration for ElastiCache.** Same vCPU and memory, same Redis/Memcached79 engine; the price drop is architectural. A cluster on `cache.m5.2xlarge`80 ($0.832/h) migrates to `cache.r6g.2xlarge` ($0.664/h) for ~20% off81 with no application change. The r7g generation is cheaper still.82- **EngineCPUUtilization, not CPUUtilization, is the right Redis metric83 for right-sizing.** CPUUtilization includes the OS overhead; the Redis84 engine's own CPU (EngineCPUUtilization) is the real constraint. A node85 with avg EngineCPUUtilization < 20% has significant headroom for86 downsize. For Memcached (multi-AZ, multi-threaded), CPUUtilization is87 the correct metric because the engine uses all cores.88- **ElastiCache Serverless (2024+) eliminates node management and auto-89 scales capacity.** It bills per-GB-hour of data plus per-vCPU-hour of90 compute. Workloads with variable load or overnight idle periods can91 save 30-60% vs provisioned nodes that sit idle. Steady-state workloads92 on large nodes are usually cheaper provisioned.93- **Reserved Nodes are ElastiCache's biggest commit lever for steady-94 state clusters.** A 1-yr no-upfront RN on `cache.r6g.2xlarge` yields95 ~40% discount vs On-Demand; a 3-yr is ~60%. RNs are engine-flexible96 within the same family (Redis OSS RN applies to any Redis OSS node of97 that class) but NOT cross-engine (Redis RN does not cover Memcached).98- **Fewer larger nodes are usually cheaper than many small nodes.** Six99 `cache.r6g.large` (6 × $0.167/h = $1.002/h) cost more than three100 `cache.r6g.2xlarge` (3 × $0.334/h = $1.002/h) at parity, but the101 smaller nodes add operational overhead. The cost breaks even at 2:1102 ratios; beyond that, fewer larger nodes win on per-node overhead.103104## Mindset105106ElastiCache cost structure differs from databases in three ways: there107is no per-I/O charge (all operations are bundled into the node-hour),108memory is the primary capacity constraint (not CPU), and replication109doubles or triples the node cost (each replica is a full node). The110levers are Graviton generation, node size, replica count, persistence111mode, and RN commits. Most ElastiCache waste comes from (a) legacy112cache.m5/r5 nodes that should be Graviton, (b) over-replicated clusters113with more replicas than the read throughput requires, or (c) AOF114persistence enabled on a cache that doesn't need durability.115116## Quick reference — verdict thresholds117118| Observation | Verdict | Dimension |119|---|---|---|120| Cluster on cache.m5/r5/c4 (pre-Graviton) | **OPPORTUNITY_FOUND** | Graviton migration |121| EngineCPUUtilization avg < 20% on cache.r6g.2xlarge+ | **OPPORTUNITY_FOUND** | Right-sizing |122| CurrConnections avg < 50 with EngineCPU < 10% | **OPPORTUNITY_FOUND** | Right-sizing or removal |123| Cluster On-Demand, steady > 6 months, no RN | **OPPORTUNITY_FOUND** | Reserved Node |124| ReplicasPerShard > 1 with read QPS < single-node capacity | **OPPORTUNITY_FOUND** | Topology |125| AOF persistence on a cache with RDB backup elsewhere | **OPPORTUNITY_FOUND** | Persistence |126| Dataset > 60% of node memory with cold keys | **OPPORTUNITY_FOUND** | Data tiering |127| Variable load, overnight idle > 50% of hours, provisioned | **OPPORTUNITY_FOUND** | Serverless fit |128| All seven dimensions at cost-optimal config | **ALREADY_OPTIMAL** | (continue monitoring) |129130## Pre-flight: data gate (run before any optimisation decision)131132ElastiCache optimisation requires four data sources: Cost Explorer for133billing line items, cluster configuration (node types, shards,134replicas, persistence), CloudWatch metrics for utilisation, and the135reserved-node inventory.136137### Required data sources138CLI data-gathering commands (Cost Explorer, ElastiCache topology, CloudWatch) moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).139Load on demand when running the live-account pre-flight data gate.140141### Data-quality short-circuits142143Data-quality short-circuit table (window length, cluster states, Global Datastore, Serverless, Memcached) moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).144Load on demand when validating observation windows and cluster states before emitting recommendations.145## Process — Optimisation logic (apply in order)146147### Step 0: Non-obvious behaviours that change the recommendation148Step-0 deep dive on non-obvious ElastiCache cost behaviours (Graviton pricing, EngineCPU vs CPU, replica billing, AOF write amplification, Serverless billing model, RN size-flexibility, data tiering, cluster-mode cost) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).149Load on demand before classifying a cluster — each behaviour changes the recommendation if ignored.150151### Step 1: Validate input and data sufficiency152153If Cost Explorer access is unavailable AND the caller has not pasted154billing line items, emit NEED_MORE_INFO:155156Full NEED_MORE_INFO output block moved verbatim to [references/worked-examples.md](references/worked-examples.md).157Load on demand when the Cost Explorer data gate fails.158### Step 2: Cost Explorer reconciliation159Cost Explorer reconciliation CLI (USAGE_TYPE breakdown) moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).160Load on demand when quantifying per-dimension spend.161162| USAGE_TYPE | Dimension | What it represents |163|---|---|---|164| `ElastiCache:NodeUsage` | Compute (provisioned) | Per-node-hour by type |165| `ElastiCache:ServerlessUsage` | Compute (Serverless) | Per-GB-hour + per-vCPU-hour |166| `ElastiCache:BackupUsage` | Snapshots | Per-GB-month of backup storage |167168If `ElastiCache:NodeUsage` dominates with nodes on m5/r5 generation, the169Graviton migration is the first lever. If ServerlessUsage is high with170steady load, the workload may be cheaper on provisioned nodes.171172### Step 3: Cost classification173174| Cost profile | Indicators | Emphasis |175|---|---|---|176| Pre-Graviton | cache.m5/r5/c4 nodes | Graviton migration (Step 5) |177| Over-provisioned | EngineCPU avg < 20%, low connections | Right-sizing (Step 4) |178| Steady On-Demand | No RN, uptime > 6 months | Reserved Node (Step 8) |179| Over-replicated | ReplicasPerShard > 1, low read QPS | Topology (Step 7) |180| High persistence cost | AOF enabled, high write volume | Persistence (Step 9) |181| Large dataset, cold tail | Memory > 60% full, inactive keys | Data tiering (Step 10) |182| Variable load | Overnight idle, spiky daytime | Serverless fit (Step 6) |183| Mixed (no single dimension dominant) | Even distribution | Apply all in parallel |184185### Step 4: Node-type right-sizing186187**Decision matrix (Redis — use EngineCPUUtilization):**188189| EngineCPU profile (30-day) | Recommendation | Savings estimate |190|---|---|---|191| avg < 20%, max < 40% on cache.r6g.2xlarge | Downsize to cache.r6g.xlarge | ~50% of compute |192| avg 20-50%, max < 70% | Keep current size | None |193| avg > 70% frequently | Upsize or add shards | None — already constrained |194| avg < 10%, CurrConnections < 50 | Consider removal or serverless | 100% if removed |195196**Decision matrix (Memcached — use CPUUtilization):**197198| CPUUtilization profile (30-day) | Recommendation | Savings estimate |199|---|---|---|200| avg < 20%, max < 40% on cache.m6g.2xlarge | Downsize one step | ~50% |201| avg 20-50% | Keep current | None |202| avg > 70% | Upsize (Memcached uses all cores) | None |203204**Worked example — Redis right-sizing:**205Full worked example (6 × cache.r6g.2xlarge → xlarge, $1,445/month) moved verbatim to [references/worked-examples.md](references/worked-examples.md).206Load on demand when right-sizing Redis nodes.207208### Step 5: Graviton-based node migration209210This is the highest-leverage dimension when the cluster is on a pre-211Graviton generation.212213| Current generation | Target | Savings | Notes |214|---|---|---|---|215| cache.m5.large ($0.226/h) | cache.r6g.large ($0.167/h) | ~26% | Same 2 vCPU / 6.05 GB |216| cache.m5.2xlarge ($0.452/h) | cache.r6g.2xlarge ($0.334/h) | ~26% | Same 8 vCPU / 26.36 GB |217| cache.r5.large ($0.250/h) | cache.r6g.large ($0.167/h) | ~33% | r5 → r6g architectural drop |218| cache.r5.2xlarge ($0.500/h) | cache.r6g.2xlarge ($0.334/h) | ~33% | Same class upgrade |219| cache.r6g.large ($0.167/h) | cache.r7g.large ($0.153/h) | ~8% | Further Graviton gen |220| cache.c4.* (legacy) | cache.r7g.* equivalent | ~35-40% | c4 is oldest; large savings |221222**Worked example — Graviton migration:**223Full worked example (m5.2xlarge → r6g.2xlarge, $517/month, 26%) moved verbatim to [references/worked-examples.md](references/worked-examples.md).224Load on demand when evaluating Graviton migration.225226### Step 6: ElastiCache Serverless fit evaluation227228Serverless eliminates node management and auto-scales. The break-even229calculation compares the provisioned node's effective utilisation230against the serverless per-GB-hour + per-vCPU-hour rate.231232**Break-even logic:**233234```235provisioned_monthly = node_count × node_hourly × 730236serverless_monthly = (data_GB × $0.00383/h × 730) +237 (compute_vCPU_hours × $0.045/h × 730)238```239240A rough heuristic: if the provisioned cluster sits below 30% average241utilisation (EngineCPU or connections), Serverless is likely cheaper.242If the cluster runs above 60% utilisation steady-state, provisioned243with an RN is cheaper.244245| Provisioned utilisation | Recommendation | Rationale |246|---|---|---|247| avg < 20%, overnight idle > 50% | Migrate to Serverless | Pay only for data + compute used |248| avg 20-40%, spiky | Evaluate Serverless; compare 30-day cost | Break-even zone |249| avg > 40% steady | Keep provisioned + RN | Provisioned cheaper at steady load |250| Dataset > 100 GB with steady load | Keep provisioned | Serverless per-GB adds up at scale |251252**Worked example — Serverless migration:**253Full worked example ($122/month provisioned → $18.39/month serverless, 85%) moved verbatim to [references/worked-examples.md](references/worked-examples.md).254Load on demand when evaluating Serverless fit.255256### Step 7: Replication group topology257258| Observation | Recommendation | Savings |259|---|---|---|260| ReplicasPerShard=2, read QPS < single-replica capacity | Reduce to 1 replica per shard | ~33% of replica nodes |261| 3 shards, dataset fits in 1 large node | Consolidate to 1 shard + 1 replica | 4 nodes eliminated |262| Non-cluster mode, dataset > single node memory | Enable cluster mode (shard) | None directly; prevents OOM |263| Cluster mode with 1 shard | Revert to non-cluster (simpler, same cost) | None (operational only) |264265**Worked example — replica reduction:**266Full worked example (9 → 6 nodes, $366/month) moved verbatim to [references/worked-examples.md](references/worked-examples.md).267Load on demand when reducing replica count.268269### Step 8: Reserved Node evaluation270Reserved Node offering query CLI moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).271Load on demand when pricing an RN purchase.272273| Pattern | Recommendation | Savings vs On-Demand |274|---|---|---|275| On-Demand, uptime > 6 months, steady load | 1-yr No Upfront RN | ~40% |276| On-Demand, uptime > 18 months, mission-critical | 3-yr No Upfront or Partial | ~60% |277| Burst-reader with spiky load | Keep On-Demand | None |278| Cluster scheduled for migration in < 6 months | No RN (commit outlasts cluster) | None |279| Existing RN on old node type (m5), migrating to r6g | Exchange via modify-reserved-cache-nodes-offering | Pro-rated exchange |280281**Reserved node exchange:**282283Reserved node exchange CLI and exchange rules moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).284Load on demand when migrating node generations with an active RN.285### Step 9: Persistence cost optimisation286287| Observation | Recommendation | Savings |288|---|---|---|289| AOF enabled on ephemeral cache (rebuildable) | Disable persistence | Node performance tax eliminated |290| AOF on high-write cache | Switch to RDB snapshots (daily) | Reduces write amplification |291| RDB snapshots with 7-day retention on small dataset | Reduce to 1-day or disable | $0.023/GB-month backup savings |292| AOF + RDB both enabled | Pick one; both is redundant | AOF performance tax |293| Persistence on, but never restored from backup in 12 months | Disable or reduce frequency | Full persistence overhead |294295Persistence deep dive (AOF vs RDB mechanics, when to disable persistence) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).296Load on demand when auditing persistence cost (Step 9).297### Step 10: Data tiering evaluation (r6gd/r7gd)298299Data tiering automatically moves infrequently accessed items to SSD,300halving the effective per-GB cost for datasets with a cold tail.301302| Observation | Recommendation | Savings |303|---|---|---|304| Dataset > 60% of node memory, > 50% keys inactive | Migrate to r6gd/r7gd (tiered) | ~45% per-GB cost |305| Dataset < 30% of node memory | Standard r6g/r7g (no tiering needed) | None |306| All keys hot (no cold tail) | Standard r6g/r7g (tiering adds overhead) | None |307| Using 4+ nodes to hold a large dataset | Consolidate to fewer r6gd nodes | Node count reduction |308309**Worked example — data tiering:**310Full worked example (6 × r6g.2xlarge → 3 × r7gd.4xlarge) moved verbatim to [references/worked-examples.md](references/worked-examples.md).311Load on demand when evaluating data tiering (Step 10).312313### Step 11: Final verdict314315The verdict is the worst-case (most-actionable) finding across all316seven dimensions:317318- If ANY dimension has a concrete recommendation with quantified319 savings, verdict is **OPPORTUNITY_FOUND**.320- If a change was applied and verified this session, verdict is321 **OPTIMIZED**.322- If all dimensions are at cost-optimal config AND RN evaluation has323 been considered, verdict is **ALREADY_OPTIMAL**.324325## Output format326327### Worked example — multi-dimension opportunity328329```text330TARGET: orders-cache-rg331VERDICT: OPPORTUNITY_FOUND332REASON: Cluster runs cache.m5.2xlarge (pre-Graviton) with333 EngineCPUUtilization avg 12%, 3 shards x 2 nodes, AOF persistence334 on an ephemeral cache, and no Reserved Node after 12 months335 steady-state. Four dimensions have actionable opportunities.336RECOMMENDATION:337 Current:338 Nodes: 6 x cache.m5.2xlarge ($0.452/h each) = $1,980/month339 Topology: 3 shards x 2 nodes (primary + 1 replica)340 Persistence: AOF (append-only file)341 Pricing: On-Demand (no RN)342 Proposed:343 - Graviton migration: cache.m5.2xlarge -> cache.r6g.2xlarge344 ($0.334/h, 26% cheaper). No application change.345 - Right-sizing: EngineCPU avg 12% / max 25% on r6g.2xlarge ->346 downsize to cache.r6g.xlarge ($0.334/h -> $0.167/h).347 - Persistence: disable AOF (cache is rebuilt from RDS on restart;348 persistence is redundant).349 - RN: 1-yr No Upfront RN on cache.r6g.xlarge after migration settles.350 Confidence: HIGH — CloudWatch confirms EngineCPU headroom; CE confirms351 On-Demand spend with no RN discount applied.352ESTIMATED_SAVINGS:353 Monthly (Graviton migration): $517 (6 x ($0.452-$0.334) x 730)354 Monthly (right-sizing): $731 (6 x ($0.334-$0.167) x 730)355 Monthly (persistence): $0 (no direct charge; performance tax)356 Monthly (reserved node): $292 (40% off 6 x $0.167 x 730)357 Monthly (topology): $0358 Annual total: $18,480359 Assumptions: us-east-1 pricing, 730h/month, Graviton + right-size360 applied before RN purchase so RN matches the new node type.361MIGRATION_STEPS:362 1. Snapshot the replication group before any change:363 aws elasticache create-snapshot \364 --cache-cluster-id orders-cache-rg-0001 \365 --snapshot-name pre-opt-$(date +%s)366 2. Create the new replication group on cache.r6g.xlarge:367 aws elasticache create-replication-group \368 --replication-group-id orders-cache-rg-v2 \369 --replication-group-description "Orders cache r6g" \370 --engine redis --cache-node-type cache.r6g.xlarge \371 --num-cache-clusters 6372 3. Sync data via application dual-write or ElastiCache DMS:373 # Start dual-writing to both clusters; wait for sync to converge374 4. Cut over the application endpoint to the new replication group.375 5. Verify EngineCPUUtilization stays < 60% in 24h on the new nodes.376 6. Disable AOF on the new group if not already:377 aws elasticache modify-replication-group \378 --replication-group-id orders-cache-rg-v2 \379 --append-only no --apply-immediately380 7. After 7 days stable, purchase RN:381 aws elasticache purchase-reserved-cache-nodes-offering \382 --reserved-cache-nodes-offering-id <offering-id> \383 --reserved-cache-node-id orders-cache-rn-1yr \384 --cache-node-count 6385 8. Delete the old replication group after verification:386 aws elasticache delete-replication-group \387 --replication-group-id orders-cache-rg388CONFIRM: Before each state-changing CLI, emit and await operator389 approval. Stage changes one dimension per window; never batch390 the Graviton migration + right-size + RN purchase.391```392393### Worked example — already optimal394Full ALREADY_OPTIMAL worked example moved verbatim to [references/worked-examples.md](references/worked-examples.md).395Load on demand when all seven dimensions pass.396397## Anti-Patterns — NEVER do these things398399- **NEVER recommend Graviton migration without confirming engine400 module compatibility.** Redis modules (RedisJSON, RedisSearch,401 RedisGraph) may have limited ARM support in older ElastiCache engine402 versions. Verify the engine version supports all loaded modules on403 Graviton before recommending migration.404405- **NEVER recommend downsize based on CPUUtilization alone for Redis.**406 Redis is single-threaded for command processing; CPUUtilization (OS-407 level) can look low while the Redis engine thread is saturated.408 Always check EngineCPUUtilization before recommending a Redis node409 downsize. For Memcached, CPUUtilization is correct.410411- **NEVER recommend reducing replicas below 1 per shard for a412 production Redis cluster.** A single-node shard has no failover413 target; if the primary fails, the shard is lost. Always retain at414 least 1 replica for HA unless the cluster is explicitly non-critical.415416- **NEVER recommend disabling AOF without confirming the cache's417 rebuild strategy.** If the application cannot rebuild the cache from418 a primary database on restart (e.g., computed values with no source),419 disabling persistence means a full cache warm-up cost on every420 failover. Confirm the rebuild path before disabling.421422- **NEVER recommend ElastiCache Serverless for a steady-state423 workload above 60% utilisation without computing the break-even.**424 Serverless per-GB-hour + per-vCPU-hour pricing exceeds provisioned425 node cost at high steady utilisation. Always compute the 30-day426 projected Serverless cost and compare against the provisioned +427 RN cost before recommending migration.428429- NEVER recommend a 3-year RN on a cluster with active migration plans.430 The RN outlasts the cluster and the commitment is billed whether or431 not the cluster exists. Match RN term to expected cluster lifetime.432- NEVER recommend adding shards for cost savings — sharding is for433 capacity or throughput, not cost. Each shard adds a full primary +434 replicas.435- NEVER exchange an RN via modify-reserved-cache-nodes-offering436 without confirming the new offering's engine and node type match437 the target cluster.438- NEVER batch the Graviton migration + node right-size + RN purchase439 in one maintenance window. Stack the changes one dimension per440 window so any regression can be attributed to a specific change.441- NEVER purchase a Memcached RN expecting size flexibility — Memcached442 RNs are tied to the specific node type; only Redis OSS RNs are443 size-flexible within a family.444445## Quick navigation446447| You want to... | Jump to |448|---|---|449| Evaluate Graviton migration (m5/r5 -> r6g/r7g) | Step 5 — Graviton migration |450| Right-size cache nodes (Redis) | Step 4 — Node right-sizing |451| Evaluate ElastiCache Serverless | Step 6 — Serverless fit |452| Reduce replica count / topology | Step 7 — Replication group topology |453| Decide on a Reserved Node | Step 8 — RN evaluation |454| Audit AOF / RDB persistence | Step 9 — Persistence cost |455| Evaluate data tiering (r6gd/r7gd) | Step 10 — Data tiering |456| Handle missing data | Step 1 — Validate input |457| Look up pricing / node types | references/elasticache-pricing-reference.md |458459## Expert heuristic — the 60-second triage460The 60-second bill triage (six ordered checks mapping symptoms to steps) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).461Load on demand when triaging an ElastiCache bill before deep-diving.462463## Pre-flight safety checks (run before any remediation CLI)464465- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation466 (`create-replication-group`, `modify-replication-group`, `delete-467 replication-group`, `create-snapshot`, `purchase-reserved-cache-468 nodes-offering`, `modify-reserved-cache-nodes-offering`), emit and469 await operator approval.470- **Snapshot before any change.** Capture a cache snapshot:471 ```bash472 aws elasticache create-snapshot \473 --cache-cluster-id $CLUSTER \474 --snapshot-name pre-opt-$(date +%s)475 ```476- **One dimension per maintenance window.** Graviton migration, node477 right-size, and RN purchase each alter cost / capacity; stacking478 them obscures which change produced any observed impact.479- **Verify EngineCPU after downsize.** Watch EngineCPUUtilization for480 24h; if avg exceeds 60%, roll back to the prior node type.481- **Replica reduction one shard at a time.** Keep one shard at full482 replica count during the transition so failover capacity is preserved.483- **Bulk-operation safety limit.** When optimising a fleet of clusters:484 sort by estimated savings (largest first); slice into batches of at485 most 3 clusters; emit per-cluster MIGRATION_STEPS with a single486 CONFIRM per batch; re-query with `describe-replication-groups` and487 verify availability before emitting the NEXT batch; abort the sweep488 if any cluster fails to stabilise within 30 min. The skill MUST NOT489 emit remediation CLI for more than 3 clusters in a single output block.490491## Verdict semantics492493| Verdict | When to emit | Position in workflow |494|---|---|---|495| `OPPORTUNITY_FOUND` | At least one dimension has a savings-bearing recommendation. | Primary — terminal for actionable findings. |496| `OPTIMIZED` | A change was applied and verified this session; CE line items confirm the new pattern. | Primary — only emitted post-remediation. |497| `ALREADY_OPTIMAL` | All seven dimensions at cost-optimal config AND RN evaluation considered. | Primary — terminal for healthy findings. |498| `NEED_MORE_INFO` | Data gate failed: CE access denied, CloudWatch window < 14 days. | Pre-decision — emit per-dimension; other dimensions can still emit OPPORTUNITY_FOUND. |499500## Recent AWS features (2024-2026)501Recent AWS features (Serverless billing, r7g, data tiering, Redis 7.2+, Global Datastore, RN exchange) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).502Load on demand when checking feature-dependent recommendations.503504## References (load on demand)505506- [references/worked-examples.md](references/worked-examples.md) — secondary worked examples: NEED_MORE_INFO block, right-sizing, Graviton, Serverless, replica-reduction, data-tiering, and ALREADY_OPTIMAL.507- [references/diagnostic-commands.md](references/diagnostic-commands.md) — pre-flight data-gathering CLI, data-quality short-circuits, Cost Explorer reconciliation, RN offering query and exchange.508- [references/advanced-patterns.md](references/advanced-patterns.md) — Step-0 non-obvious behaviours, persistence deep dive, 60-second bill triage, recent AWS features.509- [references/elasticache-pricing-reference.md](references/elasticache-pricing-reference.md) — node-type pricing lookup.510511## AWS documentation512513Domain: AWS CloudOps / Databases — Amazon ElastiCache cost optimisation.514515- **Amazon ElastiCache pricing** — https://aws.amazon.com/elasticache/pricing/516- **ElastiCache Serverless** — https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/elasticache-serverless.html517- **ElastiCache node types** — https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheNodes.SupportedTypes.html518- **Data tiering** — https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/data-tiering.html519- **Reserved Nodes** — https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/reserved-nodes.html520- **AOF vs RDB persistence** — https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups.html521- **Global Datastore** — https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html522- **AWS Cost Explorer** — https://docs.aws.amazon.com/cost-management/latest/userguide/ce-what-is.html523- **Well-Architected — Cost Optimization** — https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/welcome.html