How Can We Help?

AWS ElastiCache for Redis/Memcached

You are here:
< All Topics

ElastiCache is an in-memory DB cache. 


ElastiCache supports two open-source in-memory caching engines: Memcached and Redis


applications query ElastiCache (EC), called a “cache hit”


– if not available it seeks from RDS and then stores in EC


this relieves load on RDS


cache must have an invalidation strategy set in order to ensure the most relevant data is cached -not so easy in practice


is used for managed Redis or 1memcached


is an in-memory db with v high performance and low latency,


reduces load for read-intensive workloads


helps the application operate stateless


AWS takes care of maintenance, upgrades, patching, backups etc.


BUT you have to make major application code changes to query EC!


EC can also be used for DB user session store


which avoids users having to reauthenticate and relogin to the DB



Difference between Redis and Memcached




is similar to RDS:


allows for multi-az with auto-failover


use read replicas


data durability and high availability rather like RDS


backup and restore features





uses multi-node for partitioning of data, known as sharding


NO high availability and no replication


it is not a processing cache, so not persistent


no backup and no restore


has multi-threaded architecture



pure cache with no high availability or data protection for failure – a simpler option


Deployment Options


Amazon ElastiCache can use on-demand cache nodes or reserved cache nodes.


On-demand nodes provide cache capacity by the hour, resources are assigned when a cache node is provisioned.


You can terminate an on-demand node at any time. Billing is monthly for the actual hours used.


Reserved nodes use 1-year or 3-year contracts.


Hourly cost of reserved nodes is much lower than hourly cost for on-demand nodes.




REDIS Use Case:


need to know for exam!


Gaming Leaderboards, as these require intensive processing-


REDIS uses “sorted-sets”, this ensures accurate real-time data is generated for the leaderboard – important!



EC Security – important for exam


The EC caches do not use IAM policies, except for AWS API-level security




you use Redis Auth to authenticate – sets a password/token when creating the redis cluster


on top of security groups


supports inflight ssl





uses SASL authentication (more advanced)


3 kinds of patterns for EC – need for exam


lazy loading – all read data is put in the cache, but can become stale, but future data is only loaded when it cant find the data present in the cache, it reads from db and then copies to cache

write-through – adds or updates cahce data when written to DB – there is no stale data


Session Store: stores temp session data in cache using a TTL




DB TCP Ports


PostgreSQL: 5432


MySQL: 3306


Oracle RDS: 1521


MSSQL Server: 1433


MariaDB: 3306 (same as MySQL)


Aurora: 5432 (if PostgreSQL compatible) or 3306 (if MySQL compatible)


For the exam make sure to be able to differentiate an “Important Port” vs an “RDS database Port”.


Table of Contents