Connect remotely to ElastiCache - Redis

ElastiCache clusters can only be accessed directly from within the VPC in which it resides. This is because ElastiCache is not a secured service.

In order to connect to your ElastiCache remotely, you need to go through a bastion server or a NAT. AWS has created instructions here:

http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/Access.Outside.html

To use a bastion, you would SSH into your bastion EC2 instance that resides in your VPC. Once connected, you can tunnel your ElastiCache connection from your PC, or you can connect to your cache from your bastion's command prompt.


Step 1:

ssh -f -N -L6379:<your redis node endpoint>:6379 <your EC2 node that you use to connect to redis>

Example : ssh -f -N -L6379:redis.aps1.cache.amazonaws.com:6379 [email protected]

Step 2:

redis-cli -h 127.0.0.1 -p 6379