Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EC2 instance can't access to elasticache

As the title suggests, I'm struggling to connect to my elasticache instance via my EC2 instance. I have a orm to connect to redis in my EC2 instance that was just failing on my logs, so I sshed into my EC2 instance to try to manually connect to the redis instance and got a timeout:

Could not connect to Redis at <redis uri>: Connection timed out

They're in different VPC's (the elasticache instance and the EC2 instance), but in my elasticache instance's security group, I have a custom TCP inbound rule at port 6379 from any source.

Halp.

like image 666
Jimmy Gong Avatar asked Oct 20 '22 01:10

Jimmy Gong


1 Answers

You setup the security rule, but did you setup the VPC peering properly:

A VPC peering connection is a networking connection between two VPCs that enables you to route traffic between them using private IP addresses. Instances in either VPC can communicate with each other as if they are within the same network. You can create a VPC peering connection between your own VPCs, or with a VPC in another AWS account within a single region.

http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide/Welcome.html

like image 143
E.J. Brennan Avatar answered Oct 27 '22 10:10

E.J. Brennan