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.

...an Amazon ElastiCache Cluster, inside or outside a VPC, is never allowed to be accessed from the Internet.

From here: http://aws.amazon.com/elasticache/faqs/#Can_I_access_Amazon_ElastiCache_from_outside_AWS

不,你不可以不诉诸“招数”如隧道,这也许可以为测试而将杀死任何真正的好处使用超高速缓存与增加的延迟/开销。

……一亚马逊elasticache集群,内部或外部的VPC,从不允许从网络访问

从这里: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 127.0.0.1 -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的端口转发应该做的伎俩。试着运行这个从你的客户。

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

然后从你的客户

redis-cli -h 127.0.0.1 -p 6379

我的作品。

请注意,使用默认端口是63796739。也可以确保你可以允许你使用的连接到你的使用情况为您的缓存安全组的EC2节点安全组。

本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:http://stackoverflow.com/questions/21917661