If your EC2 is in a different subnet you should check routes and network ACL between Redis and Linux subnets, refer to this article about subnet routing.
Hope this helps.
In case this still isn't working for you please try the following:
- Check that your redis cluster has a security group added to it.
Go to ElastiCache -> Redis Clusters then select your cluster. Under "Network & Security" -> Security Groups check that there is a security group defined. If not, add a security group that allows connectivity from your EC2 instance and re-test.
- If your redis cluster already has a security group defined, check that it has an inbound rule which lets your EC2 instance connect to it.
Go to ElastiCache -> Redis Clusters then select your cluster. Under "Network & Security" -> Security Groups, select the security group to show the details of the inbound rules. Make sure there is an inbound rule for port 6379 coming from the security group of your EC2 instance (assuming you left the port number at the default)
Hopefully this will let you connect from your EC2 instance to the redis cluster using something like:
telnet <my-redis-endpoint> 6379
Connect to the database in an EC2 instance from the ECS clusterAccepted Answerasked 3 months ago
Can't connect to Aurora cluster from AWS Bastion Hostasked 3 years ago
Elastic BeanStalk can't connect to ElastiCache Redisasked 5 months ago
[Glue] Fail to connect to MySql running on EC2asked 5 years ago
Unable to connect to redis cluster with node client, what am I doing wrong?asked a year ago
Connecting to elastiCache cluster with node.jsasked 8 months ago
Connect Amazon DocumentDB Cluster from Outside Amazon VPCasked 10 months ago
Unable to connect to Redis cluster from EC2 on same VPCasked 3 months ago
AWS Redis not connectingasked 25 days ago
i am using free tier as a new user. i am connecting my EC-2 instance from my laptop through putty.Accepted Answerasked 3 months ago