Analyzing Impact Of ElastiCache Redis Minor Version Upgrade

Vinayak Pandey
2 min readJan 15, 2024

--

Recently we had to upgrade ElastiCache Redis cluster from 6.0.5 to 6.2.6 (security update elasticache-redis-6–2-update). For this we did some analysis on the impact on applications accessing this cluster during update.

Step 1: Create a Redis Cluster(keep cluster mode as disabled) with 2 replica nodes, using 6.0 engine version.

Step 2: Note down the Primary endpoint of redis cluster and create an EC2 instance to test connectivity with ElastiCache.

Connect to this instance and create a file named redis_failover.py with following code. Change value of redis host accordingly.

from redis import Redis
import logging
import time


logging.basicConfig(level=logging.INFO)
redis = Redis(host='<REDIS_ENDPOINT>', port=6379)

while True:
try:
keyName='mykey'
currTime=time.ctime(time.time())
redis.set(keyName, currTime, ex=60)
time.sleep(1)
keyValue=redis.get(keyName)
keyTTL=redis.ttl(keyName)
logging.info("Key {} was set at {} and has {} seconds until expired".format(keyName, keyValue, keyTTL))
time.sleep(1)
except Exception as e:
print(e)

Install redis package using pip3 install redis command and execute python3 redis_failover.py.

Now go to ElastiCache console and select service updates. Apply elasticache-redis-6–2-update update.

Step 3: Monitor the progress of the update. After some time you’ll see error during write operation which will last a couple of seconds.

Once the update is completed, engine version will be upgraded to 6.2.6

--

--

Vinayak Pandey
Vinayak Pandey

Written by Vinayak Pandey

Experienced Cloud Engineer with a knack of automation. Linkedin profile: https://www.linkedin.com/in/vinayakpandeyit/

No responses yet