Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to connect aws redis with ec2 on same VPC

I have created AWS ElastiCache redis server and configured with EC2 instance, but somehow I am not able to connect Redis via EC2 instance.

I have assigned the same security group as well.

here is my configuration

EC2

Redis

Error I am facing is Redis::CannotConnectError: Error connecting to Redis on some-prod.dhgdjw.0001.usw2.cache.amazonaws.com:6379 (Redis::TimeoutError)

Any help will be highly appreciated.

like image 651
Hardik Upadhyay Avatar asked Sep 15 '18 19:09

Hardik Upadhyay


People also ask

How do I connect EC2 to AWS Redis?

Connect to a Redis cluster or replication group (Windows) In order to connect to the Redis Cluster from an EC2 Windows instance using the Redis CLI, you must download the redis-cli package and use redis-cli.exe to connect to the Redis Cluster from an EC2 Windows instance.

Does ElastiCache run on EC2?

Your Amazon ElastiCache instances are designed to be accessed through an Amazon EC2 instance. If you launched your ElastiCache instance in an Amazon Virtual Private Cloud (Amazon VPC), you can access your ElastiCache instance from an Amazon EC2 instance in the same Amazon VPC.


1 Answers

As you mention the same security group where you do not need such a setting. You Redis SG should be different it just suggestion as you need it on your local VPC.

Verify Few things...

Go you ElastiCache Dashboard

Select the Redis and click on the cluster then click on modify

enter image description here

then you will see security group attach with this Cluster You can attach one or many group with this cluster.

enter image description here

click on the edit icon and verify does it allow trafic on 6379 from 10.0.0.1/16 If instance and redis in same VPC, if not then allow public IP of instance in redis SG.

enter image description here

and you can allow also your public IP to check if it accessible. Install redis-client and try this command.

redis-cli -h some-prod.dhgdjw.0001.usw2.cache.amazonaws.com ping

PONG

If ping pong working its mean SG allow traffic.

like image 105
Adiii Avatar answered Sep 19 '22 06:09

Adiii