Abdul Manaf
Abdul Manaf

Reputation: 5003

Cant connect redis-cli with amazon elastic cache

I have created a redis endpoint on amazon elastic cache and also setup vpc & NAT gateway. I need to connect created redis endpoint with redis-cli. i using command like this

redis-cli -h dev-redis.434dffsdsf.0094.ustyue1.cache.amazonaws.com 

But i got error message like this

Could not connect to Redis at dev-redis.a35gy4.0001.use1.cache.amazonaws.com:6379: Connection timed out

I tried with several ways

  1. tried to connect from my local ubuntu machine.
  2. tried to connect from a ec2 instance.

My source code is running on aws lambda. Using aws lambda we can successfully connect to the same redis endpoint.

What is the actual issue with my redis client?

Upvotes: 4

Views: 2928

Answers (3)

comiventor
comiventor

Reputation: 4142

Adding more details as none of the answers here gave me full clarity

  • What is security group - security group in AWS is like a firewall.
  • What should I check in the security group - Check in inbound rules of the security group attached to the Redis if port 6379 is open to IPs within the CIDR (e.g. 192.168.32.0/20) of the EC2 instance from which you tried to access the Redis/ElasticCache

Upvotes: 0

Brian
Brian

Reputation: 5501

Option 1 will not work, as ElastiCache instances are not accessible outside of their VPC. From the FAQs: "Amazon ElastiCache Nodes, deployed within a VPC, can never be accessed from the Internet or from EC2 Instances outside the VPC."

Option 2 should work, if the EC2 instance is within the same VPC as the ElastiCache instance.

Upvotes: 1

Aniruddha J
Aniruddha J

Reputation: 395

Please check SG of ElastiCache. Redis instance should be accessible to server where you're running Redis CLI.

Upvotes: 1

Related Questions