Skip to content

Amazon Redis ElastiCache and Redsmin

AWS Elasticache currently does not allow IP-range based access control. Therefore to connect your AWS ElastiCache cluster to Redsmin you will need to add two IPTables rules to one of your EC2 instance so it will be able to act as a proxy.

There are two scenario:

If you have an EC2 instance in the same subnet as your Redis Elasticache

  • This will only work if the EC2 instance you connect to is in the same subnet as your Elasticache Redis instance.
  • The following example will state that your Elasticache private IP is and is running on port 6379.
  • The following example will state that your EC2 private IP is and its public IP is

  • Connect to your EC2 instance through SSH
  • Then run (don't forget to change by the ElasticCache IP and port number)
  • sudo iptables -t nat -A PREROUTING -p tcp --dport 6379 -j DNAT --to-destination
  • Then run:
  • sudo iptables -t nat -A POSTROUTING -p tcp -d --dport 6379 -j SNAT --to-source
  • sudo service iptables save
  • Again don't forget to change with your local EC2 server private IP. Same goes for and 6379, replace them your Elasticache IP and port number.
  • Add a rule in the security group to allow inbound request from Redsmin IP, protocol=TCP, port=6379

  • Add a new "Redis server is exposed to internet" in redsmin with the connection string: redis://, done!
  • If you have any issue or questions with the above steps, don't hesitate, contact us, we are happy to help!
  • Don't forget to allow forwarding:
echo 1 > /proc/sys/net/ipv4/ip_forward
  • And activate it directly (no need for reboot):
sysctl -w net.ipv4.ip_forward=1
Optional checks before connecting to Redsmin:
  • You should now be able to connect from your EC2 gateway to your redis elasticache using redis-cli.
  • You should now be able to connect to your Elasticache instance through your EC2 gateway from your local laptop using redis-cli.
If both of these tests pass Redsmin will be able to administrate and monitor your Amazon Elasticache Redis server!

If you don't have an EC2 instance in the same subnet as your Redis ElastiCache

Feedback and Knowledge Base