Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to AWS elasticache?

Could someone give a step-by-step procedure for connecting to elasticache.

I'm trying to connect to a redis elasticache node from inside my EC2 instance (sshed in). I'm getting Connection Timed Out errors each time, and I can't figure out what's wrong with how I've configured my AWS settings.

They are in different VPCs, but in my elasticache VPC, I have a custom TCP inbound rule at port 6379 to accept from anywhere. And the two VPCs share an Active Peer connection that I set up. What more am I intended to do?

EDIT:

I am trying to connect via the redis-cli command. I sshed in because I was originally trying to connect via the node-redis module since my EC2 instance hosts a node server. So officially my two attempts are 1. A scripted module and 2. The redis-cli command provided in the AWS documentation.

As far as I can tell, I have also set up the route tables correctly according to this: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html#route-tables-vpc-peering

like image 384
Jimmy Gong Avatar asked Sep 24 '15 22:09

Jimmy Gong


People also ask

How do I test my ElastiCache connection?

ElastiCache supports both cluster mode disabled and cluster mode enabled Redis clusters. To test a connection to these clusters, you can use the redis-cli utility. The latest version of redis-cli also supports SSL/TLS for connecting to clusters with encryption and/or authentication turned on.

How do I connect to Redis?

To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command. In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.

How do I access Redis cache?

Connect using the Redis command-line tool. If you're using a test cache with the unsecure non-TLS port, run redis-cli.exe and pass your host name, port, and access key (primary or secondary) to connect to the test cache.


1 Answers

You cannot connect to Elasticache from outside its VPC. It's a weird design decision on AWS' part, and although it's not documented well, it is documented here:

Amazon ElastiCache Nodes, deployed within a VPC, can never be accessed from the Internet or from EC2 Instances outside the VPC.

You can set your security groups to allow connections from everywhere, and it will look like it worked, but it won't matter or let you actually connect from outside the VPC (also a weird design decision).

like image 59
Eli Avatar answered Sep 28 '22 22:09

Eli