redis-cli connection to Amazon ElastiCache Redis cluster hangs up

Brad Solomon picture Brad Solomon · Aug 27, 2018 · Viewed 9.5k times · Source

I have installed and compiled Redis from source and am attempting to connect to an Amazon ElastiCache (Redis) cluster.

I can connect to the default localhost with no problem, but attempting to connect to an AWS endpoint causes what seems to be an infinite hangup.

With defaults:

$ redis-server /etc/redis.conf  # daemonized, uses localhost
$ redis-cli ping
PONG
$ sudo service redis_6379 status
Redis is running (12919)
$ redis-cli shutdown  # or sudo service redis_6379 stop

Now, here is an attempt to connect to the endpoint, copies from AWS documentation on the topic:

redis-cli -c -h my_example_endpoint_name.eaogs8.ng.0001.use1.cache.amazonaws.com -p 6379 ping

This hangs up infinitely without anything being issued to stderr/stdout.

(Please note this is an example endpoint name; I have verified I am using the primary endpoint listed at the AWS console.)

I suspect this may be related to the security group settings for the cluster on the AWS side but am not sure specifically what could/should be modified. I appreciate suggestions of what could be blocking the connection and can provide info on the cluster itself as needed.

Answer

Liam Hession picture Liam Hession · May 8, 2019

I was also seeing the call to redis-cli hang up infinitely, but in my case it did not stem from incorrectly-configured security groups.

Instead, it occurred because I had created my Redis cluster with the 'Encryption in-transit' option set to 'Yes'. This meant my database endpoint needed to be accessed through an SSL tunnel, which redis-cli does not do.

For my application, encryption in-transit wasn't actually necessary so I created a new Redis cluster with that option not selected. More details on what you need to do differently when using in-transit encryption can be found here: https://aws.amazon.com/premiumsupport/knowledge-center/elasticache-connect-redis-node/