AWS ElastiCache

· 1 min read · AWS

Amazon ElastiCache is a fully managed in-memory data store and cache. Keeping frequently read data in memory takes load off the database (RDS, DynamoDB) and answers in microseconds. It also serves as session store, rate limiter, queue, leaderboard and message broker.

Engines #

  • Valkey and Redis OSS: data structures (strings, hashes, lists, sets, sorted sets), persistence, replication, automatic failover, pub/sub and Lua scripting.
  • Memcached: a simple, multi-threaded key-value cache.

Key concepts #

  • Cluster and replication group: a primary node with up to several replicas in different Availability Zones, and cluster mode to shard data across node groups.
  • Serverless option that scales capacity automatically, or node-based clusters with the node type you choose.
  • It runs in your VPC, in a subnet group, and is protected with security groups: it is not reachable from the Internet.
  • Encryption in transit (TLS) and at rest (KMS), authentication with passwords or IAM.
  • Caching patterns: cache-aside (lazy loading), write-through and TTLs to expire data.
  • Metrics and alarms in CloudWatch.

Pricing #

Node-based: per node hour. Serverless: per GB of data stored and per ElastiCache Processing Unit. See the ElastiCache pricing.

With Terraform #

The resources are aws_elasticache_replication_group, aws_elasticache_cluster, aws_elasticache_serverless_cache, aws_elasticache_subnet_group and aws_elasticache_parameter_group.

#AWS