Is there a way to connect Redis instance hosted on AWS from outside AWS network? I have one Windows based EC2 instance running on AWS and another one is Redis cache node.
I know this question has been asked but the answer is in context of Linux based system, but mine is Windows based server on AWS. I don't have enough score to post comments on existing questions. Here is the link to existing question on Stack Overflow:
Can you connect to Amazon Elasticache Redis outside of Amazon
Steps to access Elasticache Redis from outside of AWS.
1) Create an EC2 instance in same VPC as elasticache redis but the public subnet. Make sure that IP forwarding is enabled:
cat /proc/sys/net/ipv4/ip_forward
value ip_forward=1 indicates that forwarding is enabled
Make sure Masquerading is enabled: iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
2) Create security Group with Inbound connection on port that you intend to forward ( lets say 6379 in this case). Specify the source CIDR block for the incoming connection. Ensure that the outbound rule allows connection to the redis cluster on desired port(default redis port is 6379)
3) Add IP table rule to allow forwarding rule from EC2 instance to elasticache iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 11211 -j DNAT --to :6379
source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With