Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created March 15, 2022 07:46
Show Gist options
  • Save guitarrapc/365071dbd6b974ac6fda700a83a88037 to your computer and use it in GitHub Desktop.
Save guitarrapc/365071dbd6b974ac6fda700a83a88037 to your computer and use it in GitHub Desktop.
Connect redis-cli in Docker to TLS Encypted ElastiCache Redis Cluster.
# run on host...
docker run -it --entrypoint /bin/bash redis
# run inside docker...
apt-get update
apt-get install -y stunnel net-tools
cat <<EOF > /etc/stunnel/redis-cli.conf
fips = no
setuid = root
setgid = root
pid = /var/run/stunnel.pid
debug = 7
delay = yes
options = NO_SSLv2
options = NO_SSLv3
[redis-cli]
client = yes
accept = 127.0.0.1:6380
connect = <ElastiCache-ConfigurationEndpoint>
EOF
stunnel /etc/stunnel/redis-cli.conf
netstat -tulnp | grep -i stunnel
redis-cli -c --cluster-only-masters -h localhost -p 6380 -a 'PASS'