Can you connect to Amazon Elasticache Redis outside of Amazon

你可以连接到亚马逊elasticache redis在亚马逊

问题 (Question)

I'm able to connect to an Elasticache redis instance in a VPC from EC2 instances, but I would like to know if there is a way to connect to an Elasticache Redis node outside of Amazon EC2 instances, such as from my local dev setup or VPS instances provided by other vendors.

Currently when trying from my local set up: redis-cli -h my-node-endpoint -p 6379

I only get a timeout after some time.

Thank you,

我可以连接到一个elasticache redis实例在EC2实例的VPC,但我想知道是否有一种方式连接到一个elasticache redis节点的Amazon EC2实例外,如从我的本地开发设置或由其他供应商提供的VPS的实例。

目前在我的地方设置: redis CLI -的H我结终点磷



最佳答案 (Best Answer)

No, you can't without resorting to 'tricks' such as a tunnel, which maybe OK for testing but will kill any real benefit of using a super-fast cache with the added latency/overhead. Amazon ElastiCache Cluster, inside or outside a VPC, is never allowed to be accessed from the Internet.

From here:



从这里:HTTP:/ / AWS。亚马逊。COM / elasticache /问题/ # can_i_access_amazon_elasticache_from_outside_aws

答案 (Answer) 2

SSH port forwarding should do the trick. Try running this from you client.

ssh -f -N -L6379:<your redis node endpoint>:6379 <your EC2 node that you use to connect to redis>

Then from your client

redis-cli -h -p 6379

It works for me.

Please note that default port for redis is 6379 not 6739. An also make sure you allow the allow the security group of the EC2 node that you are using to connect to your redis instance into your Cache security group.


ssh -f -N -L6379:<your redis node endpoint>:6379 <your EC2 node that you use to connect to redis>


redis-cli -h -p 6379