Generated banner for Amazon Elasticache
Generated logo for Amazon Elasticache

Amazon Elasticache

AWSOfficialPublished by AWS

  • Skill
  • Tool integration
  • Cloud and DevOps
  • Apache-2.0
  • Medium risk
  • Has scripts

From the author

Activate when developers have latent caching needs: slow API responses, database read bottlenecks, DynamoDB throttling or cost, RDS/Aurora scaling pressure, Bedrock latency or cost, or adding a cache; activate when working with Redis, Valkey, Memcached, or any in-memory data store, cache-aside patterns, session stores, rate limiting, leaderboards, counters, streams, queues, pub/sub, distributed locks, feature flags, shopping carts, or other caching strategies. Activate for GenAI and ML retrieval: vector similarity search for low-latency retrieval, semantic caching, RAG, LLM response caching, embedding stores, AI agent memory, recommendation, personalization. Activate for ElastiCache lifecycle: provisioning (serverless or node-based), engine selection, CloudFormation/CDK/Terraform IaC, VPC connectivity, TLS, RBAC, IAM auth, Global Datastore, monitoring, troubleshooting, cost optimization, and migration from self-managed Redis. Do not trigger for browser caches, CDN/CloudFront, HTTP Cache-Control, CPU caches.
— the description by AWS

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The Amazon ElastiCache skill provides a structured, modular approach to managing in-memory data stores on AWS. It guides developers through the entire lifecycle of ElastiCache and Valkey, from initial requirements gathering and provisioning to complex data modeling, AI-driven vector search, and operational monitoring. The skill enforces best practices for connection safety, security, and infrastructure-as-code, ensuring reliable performance for caching, session management, and GenAI workloads.

What it does

  • Assesses workload requirements to recommend optimal ElastiCache configurations.
  • Automates provisioning and connectivity setup for serverless and node-based clusters.
  • Provides implementation patterns for common use cases like cache-aside, session stores, and rate limiting.
  • Supports advanced AI workloads including semantic caching, RAG, and vector similarity search.
  • Delivers operational diagnostics for performance tuning, cost optimization, and troubleshooting.
  • Manages migration paths from self-managed Redis or between different deployment models.

When to use it

  • When you need to reduce database load or improve API response times with an in-memory cache.
  • When implementing AI agent memory, RAG retrieval, or semantic caching for LLM applications.
  • When migrating existing Redis workloads to a managed AWS environment.
  • When troubleshooting performance issues like high latency, replication lag, or memory pressure.
  • When setting up secure, production-ready caching infrastructure using IaC.

Advantages

  • Standardizes deployment and operational patterns across development teams.
  • Ensures compliance with security best practices like TLS and IAM authentication.
  • Reduces configuration errors through automated input validation and tagging.
  • Provides clear guidance on engine selection and version-specific feature availability.
  • Simplifies complex tasks like cross-region migration and vector search setup.

Usage examples

“I need to speed up my RDS database. Should I use ElastiCache?”
The agent will initiate the requirements sub-skill to analyze your workload, stack, and latency needs, then provide a recommendation on whether ElastiCache is the right fit.
“How do I set up a Valkey cluster for vector search?”
The agent will route to the genai sub-skill, verify you are using a node-based Valkey 8.2+ cluster, and provide the necessary configuration and code to enable vector similarity search.
“My cache hit rate is low and latency is spiking. Can you help me troubleshoot?”
The agent will activate the monitoring sub-skill to analyze your metrics, identify potential hot keys or memory imbalance, and suggest specific remediation steps.
“Help me migrate my self-managed Redis to ElastiCache.”
The agent will guide you through the migration sub-skill, performing preflight checks and validating your source configuration for a zero-downtime cutover.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/aws/amazon-elasticache/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip amazon-elasticache.zip -d .agents/skills

Documentation by AWS

ElastiCache

A modular ElastiCache toolkit organized as a registry of sub-skills. Each sub-skill handles one domain of ElastiCache work. The router below matches user intent to the right sub-skill, then loads only the references needed for that sub-skill.

How this skill works

  1. Match the user's request against the semantic categories in the registry below. Match on meaning, not exact wording ("help me figure out which data structures to use" matches data-modeling even without the word "pattern").

  2. Disambiguation: If the user's intent matches multiple sub-skills, apply these rules in order:

    • If .elasticache/requirements.json exists with infrastructure.endpoint set, prefer monitoring or data-modeling (the user has an existing cache).

    • If no cache exists (no requirements.json or no endpoint), prefer requirements.

    • If still ambiguous, ask one clarifying question: "Are you looking to set up something new, or troubleshoot something existing?"

  3. Check the Guardrails section before recommending an engine or deployment model.

  4. Read references/{sub-skill-id}/instructions.md for the matched sub-skill. If the file is not found at a relative path, check your prompt or environment for the skill directory absolute path and retry with {skill-directory}/references/{sub-skill-id}/instructions.md.

  5. If the request spans multiple sub-skills, execute them in pipeline order.

  6. If a sub-skill requires upstream context (engine, deployment model, endpoint) not yet in session memory, route to the upstream sub-skill first.

  7. If no sub-skill matches, activate requirements first.

  8. If a script or CLI call fails, show the error to the user and suggest a specific fix before retrying.

Sub-skill registry

Each entry has: an ID (directory name under references/), a domain description, semantic categories for matching, and upstream/downstream dependencies.

IDNameDomainSemantic CategoriesUpstreamDownstream
requirementsSolution FitGathers workload, stack, scale, latency, persistence, and budget through workspace scan + structured interview. Decides whether ElastiCache is the right service and hands off with a routing recommendation.I need a cache, speed up my app, reduce database load, lower Bedrock cost, should I use ElastiCache, what's best for my workload, evaluating cache options, ElastiCache vs X, Valkey vs X, vague new workload—setup, data-modeling, genai, monitoring, migration
setupCreate and ConnectProvisioning, connectivity, security, authentication, IaC, deployment choice. Gets the user to a working cache with least friction. Covers engine selection, serverless vs node-based, VPC, TLS, RBAC/IAM, jump-host/SSM tunnels, CLI/SDK/CFN/CDK/Terraform starters.create a cache, set up ElastiCache, provision, Valkey cluster, connect Lambda/ECS/EKS/EC2, VPC, security groups, TLS, RBAC, IAM auth, jump host, SSM tunnel, CloudFormation, CDK, Terraform, engine selection, serverless vs node-based, backup, snapshot, restore, exportrequirements (optional)data-modeling, genai, monitoring
data-modelingApplication PatternsPicks data structures, key schema, TTL strategy, invalidation approach, and client code for non-AI patterns: cache-aside, session store, rate limiting, leaderboards, counters, pub/sub, streams, shopping carts, job queues, activity feeds.session store, rate limiting, leaderboard, cache-aside, query caching, counters, streams, pub/sub, shopping cart, job queue, activity feed, key schema, TTL, invalidation, data structuressetup (cache must exist)monitoring
genaiAI and Vector WorkloadsClassifies request into Mode 1 (plain cache), Mode 2 (semantic response cache), or Mode 3 (full vector search). Selects Valkey and forces node-based Valkey 8.2 or above (recommend 9.0) when server-side vector similarity is needed. Covers semantic caching, agent memory, RAG retrieval, recommendation, personalization, conversation/session persistence for AI agents, and framework wiring (Strands, mem0, LangChain).semantic cache, RAG, agent memory, conversational memory, vector search, embeddings, recommendation, personalization, Bedrock latency, Bedrock cost, LLM caching, Strands, mem0, LangChain, conversation history, AI session store, embedding provider, framework integrationsetup (cache must exist)monitoring
monitoringOperate and ObserveDiagnoses performance, cost, and reliability using metrics first, then recommends the smallest change. Covers dashboards, alarms, log delivery, cost reporting, event routing, troubleshooting high CPU / memory / replication lag / connection spikes / low hit rate / hot keys / big keys / slot imbalance / latency spike root cause.cache is slow, cost too high, hit rate low, high CPU, memory pressure, replication lag, connection spikes, dashboards, alarms, CloudWatch, cost comparison, troubleshoot, hot key, uneven shard load, one node pinned, big key, memory bloat, which key is biggest, keyspace distribution, prefix analysis, cost attribution by tenant, memory imbalance, one shard full, slot memory skew, latency spike, slow command incident, root cause for latency bump—setup, migration
migrationEngine and Platform MigrationSelects the migration path and sequences preflight, validation, cutover, and rollback. Covers self-managed Redis → ElastiCache, Redis OSS → Valkey, node-based ↔ serverless, version upgrades. Hard validate-before-migrate gate.migrate, Redis OSS to Valkey, self-managed to ElastiCache, node-based to serverless, serverless to node-based, engine upgrade, version upgrade, zero-downtime cutover, rollback—setup, monitoring

Pipeline order

Sub-skills run independently, but common multi-step journeys follow these pipelines:

  • requirements → setup → (data-modeling | genai) → monitoring

  • migration → setup → monitoring

  • monitoring → setup | migration (if metrics indicate)

State handoff: requirements.json

.elasticache/requirements.json is the single source of truth for cross-sub-skill state. Each sub-skill reads it at start and writes its section after completing work. Read before writing; merge, do not overwrite.

SectionOwnerKey fields
top-levelrequirementsengine, deployment_model, region, runtime, patterns, use_case, vpc_id, subnet_ids, security_group_ids
infrastructuresetupcache_name, resource_id, engine_version, topology, endpoint, port, auth_model, tls, client_library, execution_path, access_mode, tunnel_instance_id, embedding_provider, embedding_model, embedding_dim, embedding_module
genaigenaimode, mode_2_path, framework
migrationmigrationsource_type, source_host, migration_path, cutover_status

Ownership note: deployment_model is set by requirements during initial interview. migration may update it after an engine or deployment model switch (e.g., node-based to serverless).

requirements.json should include "schema_version": 1 and "last_updated": "<ISO timestamp>" at the top level. Every sub-skill that writes to requirements.json must update last_updated. If last_updated is older than 7 days, warn the user that cached state may be stale.

requirements.json tracks one active cache. If the user works with multiple caches in the same project, confirm which cache is active before reading or writing state.

When a sub-skill needs upstream context (engine, endpoint, auth model), check requirements.json first. If the field is null or the file does not exist, route to the upstream sub-skill.

Global rules (apply to every sub-skill)

  1. Execution path. Use AWS CLI, SDK (boto3), CloudFormation, or CDK as the primary path for control-plane work. Use valkey-py as the primary path for data-plane work.

  2. Response depth. Summary (2-3 sentences) for "should I" or "which" questions. Standard (recommendation + config + code + next steps) by default. Expert (full decision matrix with alternatives, cost, security caveats) for "why" or "compare all" questions. Escalate on user request; never downgrade unprompted.

  3. Session memory. Track region, VPC, engine, deployment model, auth model, compute runtime, and language. Carry forward across sub-skills. Do not re-ask. If the user overrides a value, update it everywhere. Inferred values (from workspace scan or IaC) must be re-confirmed before high-risk decisions (engine, deployment model, security posture); low-risk inferences (language, framework, region) can be used as defaults silently.

  4. Source priority. Always answer from skill-local files first (sub-skill references, then scripts/). Do not fetch external documentation or web search unless the local files cannot answer the query. When local files are insufficient, fall back to official AWS docs: https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ for features and https://aws.amazon.com/elasticache/pricing/ for pricing. Never invent price points or version constraints. If the user references a Valkey or Redis version, feature, or pricing tier not covered in local files, fall back to https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ before answering. Do not extrapolate from local content that may be outdated.

  5. Freshness disclaimer. When outputting pricing, version constraints, or feature availability, include a one-line disclaimer: "For current pricing see https://aws.amazon.com/elasticache/pricing/. For current feature availability see https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/."

  6. Connection safety. Never create a Valkey/Redis client at module level (top of file, import time). Initialize connections inside a function or on first use. Module-level connections crash applications that import the module before the cache is reachable.

  7. Code environment. Use python3 (not python) in all commands and shebangs. Do not generate pip install or pytest commands in application code. Prefer the agent's file-writing tool over shell redirection for writing files.

  8. Input validation (write operations only). Before running any create, modify, or delete CLI command or SDK call that uses user-provided values (cache name, region, subnet IDs, security group IDs, VPC ID, KMS key, snapshot name), validate them with scripts/input_validator.py. Run python3 scripts/input_validator.py cache_name=<val> region=<val> ... or import validate_all as a library. Skip validation for read-only operations (describe, list) where bad input is harmless.

  9. Resource tagging (always apply on resource creation). When creating any cache (create-serverless-cache, create-replication-group, create-cache-cluster), ALWAYS include these tags:

    --tags Key=managed_by,Value=aws-skills Key=skill,Value=elasticache Key=skill_version,Value=1.0.0 Key=created_by,Value=elasticache-skill Key=generation_model,Value={your-model-id}

    Example: --tags Key=managed_by,Value=aws-skills Key=skill,Value=elasticache Key=skill_version,Value=1.0.0 Key=created_by,Value=elasticache-skill Key=generation_model,Value=claude-sonnet-4-20250514

    Set generation_model to your own model identifier. Include these tags even if the user does not mention tagging. If the user provides additional tags, append these to their tags rather than replacing them.

Reference loading

Load additional references only when the current turn's answer requires them.

On-demand pointers (not preloaded; fetch when the trigger applies):

  • references/shared-ux/production-readiness.md — when the user asks if their cache is ready for production, or after setup completes and the user wants to go to production

  • references/shared-ux/action-safety.md — before any destructive action (risk levels, never-auto-execute list)

  • references/shared-ux/error-remediation.md — when the user hits a specific ElastiCache error code (MOVED, CROSSSLOT, CLUSTERDOWN, MULTI/EXEC+IAM, etc.)

  • references/shared-foundation/boundary-doc.md — when the user asks what this skill covers

  • references/shared-foundation/attribution.md — when generating CLI commands, SDK code, or IaC templates

  • references/shared-foundation/architecture-diagrams.md — when the user asks for architecture diagrams or visual reference

  • references/shared-runtime/lambda.md — when connecting from Lambda (cold start gotchas, IAM auth code, lazy init)

  • references/shared-runtime/ecs.md — when connecting from ECS (SIGTERM shutdown, connection pool drain, task definition)

  • references/shared-runtime/eks.md — when connecting from EKS (IRSA, service mesh bypass, SecurityGroupPolicy CRD)

  • references/shared-runtime/api-gateway.md — when integrating with API Gateway (no direct path, caching layers comparison)

  • references/shared-runtime/rds-acceleration.md — when caching RDS/Aurora queries (thundering herd, stampede protection, invalidation)

  • references/shared-runtime/secret-injection.md — when the user asks about credential management per compute platform

  • references/shared-security/encryption-defaults.md — when adding encryption to an existing unencrypted cluster (TLS two-step migration, at-rest immutability)

  • references/shared-security/config-guardrails.md — when the user wants continuous compliance monitoring (AWS Config rules, custom Lambda rules)

  • references/shared-security/vpc-patterns.md — when debugging port/security-group issues (port 6380 serverless reader, anti-patterns)

Folder convention: references/ contains 10 folders. 6 match the sub-skills (requirements, setup, data-modeling, genai, monitoring, migration) and are routing destinations. The 4 shared-* folders (shared-foundation, shared-ux, shared-security, shared-runtime) are cross-cutting material loaded on demand, not routing destinations.

Guardrails

PriorityRule
CRITICALVector search MUST use node-based Valkey 8.2 or above. Serverless does NOT support vector search. Never suggest serverless for vector search. Apply this regardless of which sub-skill activates.
CRITICALDo not invent price points or version constraints. Use scripts/price_calculator.py and current AWS docs when precision matters.
HIGHDo not recommend Memcached when the user needs persistence, replication, RBAC or IAM auth, sorted sets, streams, pub/sub, or vector search.
HIGHDo not assume local laptop access works directly. ElastiCache is VPC-centric; explain VPC, tunnel, or jump-host access when needed.
STANDARDDo not trigger on every generic Redis mention. Trigger when the user is clearly asking about AWS, managed caching, migration, connectivity, pricing, operations, or AWS service integration.
STANDARDFor ambiguous "cache" requests inside AWS contexts, activate this skill and start with requirements.

Product truths

  • ElastiCache Serverless deploys in under a minute and removes infrastructure management.

  • Valkey serverless pricing is 33% lower than other supported engines; node-based Valkey pricing is 20% lower.

  • Serverless caches have in-transit encryption always enabled (cannot be disabled).

  • IAM auth is available for all ElastiCache Valkey versions (7.2 is the baseline Valkey version on ElastiCache) and Redis OSS 7.0+.

  • Valkey version ladder: 7.2 (baseline), 8.0 (20% more data per node (capacity improvement), per-slot metrics), 8.1 (Bloom filters, COMMANDLOG, SET IFEQ, 20% less memory via new hash table (efficiency improvement)), 8.2 (vector search), 9.0 (recommended default for new clusters). Recommend Valkey 9.0 for new clusters unless a specific feature dictates otherwise.

  • Vector search is available for Valkey 8.2 or above on node-based clusters (recommend 9.0).

  • Global Datastore is available for node-based clusters only. It does not support IPv6 or Local Zones. Global Datastore supports AUTH and RBAC. Cross-region failover must be promoted manually (no autofailover across regions). At-rest encryption must be enabled on all clusters in the Global Datastore, but each cluster can use a separate KMS key per region.

  • Online migration from self-managed Redis to ElastiCache requires: (source) AUTH must not be enabled, protected-mode set to no, replication and administrative commands must not be renamed (e.g., sync, psync, info, config, command, cluster); (target) encryption in-transit disabled, Multi-AZ enabled, engine version Redis OSS 5.0.6+ or Valkey 7.2+, not part of a Global Datastore, data tiering disabled. Shard counts must match between source and target. All source Redis instances must use the same port. Online migration is not supported for serverless caches (node-based targets only). See references/migration/topology-validation.md for the full checklist.

Files

references/monitoring/troubleshooting.md

Troubleshooting Playbooks

Symptom-based runbooks for diagnosing and resolving common ElastiCache operational issues.

Diagnostic Quick Reference

SymptomFirst Metric to CheckFirst ActionDeployment
Slow responsesEngineCPUUtilizationCheck slow log for expensive commandsBoth
Low hit rateCacheHitRate, EvictionsVerify TTLs and eviction policyBoth
Connection errorsCurrConnectionsCheck security groups and connection poolingBoth
High CPUEngineCPUUtilization per nodeLook for hot keys or expensive commandsNode-based
OOM / write failuresDatabaseMemoryUsagePercentageCheck eviction policy and key TTLsNode-based
Stale readsReplicationLagCheck write volume and replica capacityNode-based
Throttled (serverless)ThrottledCmds, ElastiCacheProcessingUnitsIncrease ECPU limitServerless
Connection dropsdescribe-eventsCheck for failover events, verify retry logicBoth

CLI Template for Metric Checks

All investigation steps below reference metrics by name. Use this template, substituting the metric name and dimensions.

aws cloudwatch get-metric-statistics \
  --namespace AWS/ElastiCache --metric-name <metric-name> \
  --dimensions Name=<dimension-name>,Value=<dimension-value> \
  --start-time <start> --end-time <now> --period <seconds> --statistics <stat> \
  --region <region>

Common dimensions: ReplicationGroupId (cluster-wide), CacheClusterId (per node), ServerlessCacheName (serverless).


Metric Units Quick Reference

MetricDeploymentUnitCommon Mistake
ReplicationLagNode-basedSecondsNot milliseconds. Threshold of 1 = 1 second.
SuccessfulReadRequestLatencyBothMicrosecondsNot milliseconds. 5000 = 5ms.
SuccessfulWriteRequestLatencyBothMicrosecondsNot milliseconds. 5000 = 5ms.
BytesUsedForCacheBothBytesNot GB. 1 GB = 1,073,741,824 bytes.
ElastiCacheProcessingUnitsServerlessCount (ECPUs)Sum over period, not rate.
ThrottledCmdsServerlessCountSum over period.
DatabaseMemoryUsagePercentageNode-basedPercentNot a ratio. 80 = 80%.
DatabaseCapacityUsagePercentageNode-basedPercentAvailable on all node-based clusters. On data-tiering instances (r6gd), the formula includes SSD storage; on all other instances, it is calculated as used_memory/maxmemory.
EngineCPUUtilizationNode-basedPercentSingle-threaded engine; can hit 100% on one core while host CPU is low.
CacheHitRateBothPercentEmpty until cache serves real traffic.
Slow log durationBothMicrosecondsNot milliseconds. 10000 = 10ms.

Metrics Return Empty

New caches take 5-10 minutes to emit their first CloudWatch datapoints. Serverless caches with zero traffic emit no metrics at all (this is normal, not broken). After confirming the cache exists with describe-serverless-caches or describe-replication-groups, wait for traffic before investigating further.


High Latency

Applies to: Both serverless and node-based. Severity: P1 (fix now)

AspectDetail
SymptomsSuccessfulReadRequestLatency or SuccessfulWriteRequestLatency elevated
Key metricsEngineCPUUtilization, SuccessfulReadRequestLatency, SuccessfulWriteRequestLatency, CurrConnections
Likely Causes
  1. Slow commands: KEYS *, SMEMBERS on large sets, HGETALL on large hashes, SORT on large lists

  2. Network latency: cross-AZ traffic, VPC peering hops, insufficient bandwidth

  3. TLS overhead: handshake on every new connection (mitigated by connection reuse)

  4. Insufficient capacity: node CPU/memory saturated, or serverless ECPU limit reached

  5. Hot key: single key bottlenecking a single shard

Investigation Steps

Check: EngineCPUUtilization (per node, Maximum), CurrConnections (Maximum). For slow log:

aws logs filter-log-events --log-group-name <your-slow-log-group> \
  --region <region>

Stop condition: If EngineCPUUtilization is below 60% and CurrConnections is stable, this is not a capacity or connection problem. Check slow log for expensive commands next.

Resolution
  • Slow commands: replace KEYS with SCAN, use SSCAN/HSCAN/ZSCAN for large data structures

  • Network: colocate app and cache in same AZ, use reader endpoints for read-heavy workloads

  • TLS: enable connection pooling and reuse connections

  • Insufficient capacity: scale up node type, add shards, or increase serverless ECPU limits

  • Hot key: distribute across multiple logical keys with client-side sharding, or add read replicas. For detailed diagnosis, see hot-key-detection.md. For intermittent spikes with slow-log correlation, see slow-log-cross-signal-diagnosis.md.

Low Hit Rate

Applies to: Both serverless and node-based. Severity: P2 (fix next business day)

AspectDetail
SymptomsCacheHitRate below 80%, backing store load not decreasing
Key metricsCacheHits, CacheMisses, CacheHitRate, Evictions, DatabaseMemoryUsagePercentage
Likely Causes
  1. TTL too short: keys expire before reuse

  2. Wrong eviction policy: keys evicted before natural expiry

  3. Cold cache: recently created or restarted, not yet populated

  4. Key space mismatch: different key naming between write and read paths

  5. Cache stampede: concurrent requests miss simultaneously, overwhelming the backend

Investigation Steps

Check: Evictions (Sum), DatabaseMemoryUsagePercentage (Maximum), CacheHitRate (Average). All at ReplicationGroupId level.

Stop condition: If Evictions is zero and DatabaseMemoryUsagePercentage is below 70%, eviction is not the cause. Focus on key naming and TTL mismatch.

Resolution
  • TTL too short: increase TTL. Start with 5-15 min for frequently changing data, 1-24 hours for reference data.

  • Wrong eviction policy (node-based only): use allkeys-lru for general caching. Use volatile-lru only if some keys must never be evicted. Note: Serverless caches use volatile-lru and this is not configurable; ensure all keys have TTLs set to enable eviction on serverless.

  • Cold cache: implement cache warming on deployment or restart.

  • Key space mismatch: audit key naming in write and read paths. Ensure derivation is deterministic and identical.

  • Cache stampede: implement locking (SETNX-based) so only one request populates on miss, or use "stale while revalidate" TTLs.

Connection Spikes

Applies to: Both serverless and node-based. Severity: P1 (fix now)

AspectDetail
SymptomsCurrConnections spikes, NewConnections elevated, connection errors in app logs
Key metricsCurrConnections, NewConnections, EngineCPUUtilization
Likely Causes
  1. Connection storm: app restart causing all instances to connect simultaneously

  2. Missing connection pooling: each request opens a new connection

  3. Lambda cold starts: each cold start establishes a new connection

  4. Connection leaks: connections not returned to pool

Investigation Steps

Check: CurrConnections (Maximum, period 60s), NewConnections (Sum, period 60s). Compare per-node to find imbalance.

Resolution
  • Connection storm: implement backoff with jitter on startup

  • Missing pooling: use connection pools (max_connections in client library)

  • Lambda cold starts: initialize connection outside handler. Consider provisioned concurrency or serverless cache.

  • Connection leaks: add health checks, set idle timeout, implement cleanup in finally blocks

High CPU

Applies to: Node-based only. For serverless, see Throttling. Severity: P1 (fix now)

AspectDetail
SymptomsEngineCPUUtilization above 90%, increased latency
Key metricsEngineCPUUtilization, CPUUtilization, CurrConnections
Important: CPUUtilization vs EngineCPUUtilization

EngineCPUUtilization measures only the main Redis/Valkey engine thread and is the recommended metric for monitoring engine capacity. CPUUtilization reflects aggregate CPU usage across all cores, including dedicated I/O threads from Enhanced I/O features, and is not a reliable indicator of engine capacity for nodes with 4+ vCPUs. For nodes with 2 or fewer vCPUs, use CPUUtilization with a threshold of 90 divided by the number of cores (e.g., 45% for 2-core nodes). For nodes with 4+ vCPUs, use EngineCPUUtilization with a 90% threshold.

Likely Causes
  1. Hot key: one key receiving disproportionate traffic on a single shard

  2. Expensive commands: KEYS, SORT, SUNIONSTORE on large datasets, complex Lua scripts

  3. Insufficient shards: workload concentrated on too few shards

  4. High connection churn: TLS handshake overhead with many short-lived connections

Investigation Steps

Check: EngineCPUUtilization (per node via CacheClusterId, Maximum, period 60s). Compare across nodes to find hot shards. For slow log:

aws logs filter-log-events --log-group-name <your-slow-log-group> \
  --region <region>

Also check command-family metrics (StringBasedCmds, HashBasedCmds, etc.) on the hot node to identify the data type driving load before scanning slow logs.

Resolution
  • Hot key: use client-side caching, replicate key with suffixes (hotkey:1, hotkey:2) and load-balance reads

  • Expensive commands: replace KEYS with SCAN, use SSCAN/HSCAN/ZSCAN, limit Lua complexity

  • Insufficient shards: add shards (modify-replication-group-shard-configuration), rebalance slots

  • Connection churn: implement connection pooling, use keep-alive

Memory Pressure

Applies to: Node-based primarily. Serverless auto-scales storage but can hit configured limits. Severity: P1 (fix now)

AspectDetail
SymptomsDatabaseMemoryUsagePercentage above 80%, Evictions increasing, OOM errors
Key metricsDatabaseMemoryUsagePercentage, BytesUsedForCache, Evictions, CurrItems. For data-tiering instances (r6gd), also check DatabaseCapacityUsagePercentage which covers both memory and SSD tiers.
Likely Causes
  1. No eviction policy: maxmemory-policy set to noeviction, rejects writes when full

  2. Large keys: individual keys in the MB range consuming disproportionate memory

  3. Memory fragmentation: high MemoryFragmentationRatio

  4. TTL not set: keys persist indefinitely

Investigation Steps

Check: DatabaseMemoryUsagePercentage (Maximum, period 3600s over 7d), Evictions (Sum, period 3600s over 7d). To check eviction policy:

aws elasticache describe-cache-parameters \
  --cache-parameter-group-name <parameter-group> \
  --region <region> \
  --query "Parameters[?ParameterName=='maxmemory-policy']"

Stop condition: If Evictions is zero and memory is rising slowly, this may be normal growth. Only act if approaching 80% or evictions are sustained.

Resolution
  • No eviction policy: set maxmemory-policy to allkeys-lru

  • Large keys: break into smaller keys, compress values, use hashes instead of large JSON blobs. For detailed big-key diagnosis, see big-key-hunter.md.

  • Memory fragmentation: restart during maintenance window. For node-based, set activedefrag to yes in the parameter group (CONFIG SET is restricted on ElastiCache).

  • TTL not set: audit key creation code, add TTLs. Use OBJECT IDLETIME to find stale keys.

  • Reserved memory: set reserved-memory-percent to 25 (for Valkey and Redis OSS 2.8.22+) or 50 (for older Redis OSS versions) via a custom parameter group. The default is 25% for all parameter group families (available since March 2017). For accounts created before March 16, 2017, older parameter families may default to 0. A value of 0 allows the engine to consume all of maxmemory with data, leaving insufficient memory for background write processes (BGSAVE, replication sync), which can cause snapshot and sync failures.

  • Scale up: larger node type or add shards to distribute data

Replication Lag

Applies to: Node-based only. Serverless handles replication internally. Severity: P2 (fix next business day, P1 if > 5s)

AspectDetail
SymptomsReplicationLag above 1s, stale reads from replicas, failover risk
Key metricsReplicationLag, ReplicationBytes, NetworkBytesOut (primary), SaveInProgress
Likely Causes
  1. Write-heavy workload: primary generating data faster than replicas can consume

  2. Insufficient replica capacity: replica node type too small

  3. Network bandwidth: replication traffic saturating the interface

  4. Background save: BGSAVE/snapshot operations competing for I/O

Investigation Steps

Check: ReplicationLag (per replica via CacheClusterId, Maximum, period 60s), SaveInProgress (per primary, Maximum, period 60s).

Stop condition: If SaveInProgress is 1 and lag correlates with snapshot timing, this is snapshot-induced. Schedule snapshots during off-peak rather than scaling.

Resolution
  • Write-heavy workload: add shards to distribute writes, or batch writes using pipelining

  • Insufficient replica capacity: scale up replica node type (must match primary in most configs)

  • Network bandwidth: move to a larger node type

  • Background save: schedule snapshots during low-traffic periods

Throttling (Serverless)

Applies to: Serverless only. Severity: P1 (fix now)

AspectDetail
SymptomsThrottledCmds increasing, throttle errors in clients, ElastiCacheProcessingUnits near max
Key metricsThrottledCmds, ElastiCacheProcessingUnits
Likely Causes
  1. ECPU limit reached: CacheUsageLimits.ECPUPerSecond.Maximum too low for current workload

  2. Burst traffic: sudden spike exceeding configured maximum

  3. Expensive commands: single commands consuming many ECPUs (e.g., SORT, ZRANGEBYSCORE returning thousands)

Investigation Steps

Check: ElastiCacheProcessingUnits (Sum, period 60s), ThrottledCmds (Sum, period 60s). Use ServerlessCacheName dimension.

Resolution
  • Increase ECPU limit:

    aws elasticache modify-serverless-cache \
      --serverless-cache-name <name> \
      --cache-usage-limits '{"ECPUPerSecond": {"Maximum": <higher-value>}}' \
      --region <region>
  • Optimize commands: replace expensive operations with efficient alternatives, use pipelining

  • Cost concern: consider node-based for steady-state high-throughput with reserved pricing

  • Add client-side retry: exponential backoff for throttled commands

Failover Events

Applies to: Node-based primarily. Serverless handles failover transparently. Severity: P1 (fix now)

AspectDetail
SymptomsBrief connection interruption, DNS endpoint change
Key metricsReplicationLag (pre-failover), events from describe-events
Likely Causes
  1. Node failure: hardware or software issue on the primary

  2. AZ failure: entire Availability Zone unavailable

  3. Maintenance: service update applied during maintenance window

  4. Manual failover: operator-initiated via test-failover

Investigation Steps

Check recent events:

aws elasticache describe-events \
  --source-type replication-group \
  --source-identifier <replication-group-id> \
  --duration 1440 \
  --region <region>

Also check ReplicationLag (Maximum) before the event; high lag means potential data loss.

Resolution
  • Ensure Multi-AZ is enabled: automatic failover; failover time varies depending on cluster size and configuration

  • Application resilience: retry with backoff. Most client libraries handle failover with cluster-aware config.

  • DNS caching: set app DNS TTL to 5 seconds or less

  • Post-failover: verify replication is healthy, confirm new primary is in expected AZ

  • Prevent data loss: keep ReplicationLag low. High lag before failover means unreplicated writes are lost.

Cannot Connect

Applies to: Both serverless and node-based. Severity: P1 (fix now)

AspectDetail
SymptomsConnection timeout, connection refused, TLS handshake failure
Key metricsCurrConnections (if any succeed), describe-events for failover
Decision Fork
  • Never worked (new setup): Security group, subnet, or endpoint misconfiguration. Check the setup sub-skill's connectivity-diagnostics.

  • Was working, now broken: Recent change or failover event.

Likely Causes (was working, now broken)
  1. Security group change: inbound rule removed or modified

  2. Failover event: DNS endpoint changed, client caching old IP

  3. Auth credential rotation: password or IAM token expired

  4. TLS certificate mismatch: client missing CA bundle or wrong ssl_cert_reqs setting

  5. Network change: VPC peering route removed, subnet NACL modified

  6. maxclients reached: some connections succeed but new ones are rejected. Check CurrConnections against node's maxclients (default 65,000 for most instance types; exceptions: t2.micro/small/medium and t3.micro = 20,000; t3.small/medium = 46,000; t4g.micro = 20,000)

Investigation Steps

Check describe-events for recent failover. Verify security group allows inbound on port 6379 from the client's security group. Test with:

valkey-cli -h <endpoint> -p 6379 --tls PING

If TLS fails, try without TLS to isolate (note: serverless always requires TLS).

Resolution
  • Security group: add inbound rule for port 6379 from client SG

  • Failover DNS: set client DNS TTL to 5s or less; restart application to pick up new IP

  • Auth expired: rotate credentials in Secrets Manager or refresh IAM token

  • TLS: ensure client uses ssl=True and the correct CA bundle (Amazon root CA)

  • Never worked: route to setup/connectivity-diagnostics.md

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Python, Needs Node.js

Security

What our scanner noticed· Medium risk

  • References to credential files
  • Instructions that use the network
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
AWS
Publisher
AWS (Official)
Source
aws/agent-toolkit-for-aws · skills/specialized-skills/database-skills/amazon-elasticache · commit 0a218f8
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • NOTICE (added by AutoGineer from NOTICE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by AWS or AWS.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download amazon-elasticache.zip