I am trying to connect to my Redis instance from my from my local machine by following this guide, where you create a Compute Engine instance to use for port forwarding to the Redis instance.
I was able to create the Compute Engine instance using:
gcloud compute instances create redis-port-forward-vm --machine-type=f1-micro --zone=us-east1-d
.
When I try to create an SSH tunnel that port forwards traffic through the Compute Engine VM using:
gcloud compute ssh redis-port-forward-vm --zone=us-east1-d -- -N -L 6379:REDIS_INSTANCE_IP_ADDRESS:6379
.
I get the following error:
channel 2: open failed: connect failed: Connection timed out
.
I don’t understand what could be the issue, I am able to successfully SSH into the Compute Engine instance, but port forwarding is not working.
2
Answers
I assume you’re replacing
REDIS_INSTANCE_IP_ADDRESS
with the value.You can also pass
--ssh-flag
togcloud
directly.Does this work?
Follow the below steps,
sudo apt-get install redis-server
gcloud compute ssh redis-port-forward-vm --zone=us-east1-d
redis-cli -h REDIS INSTANCE IP -p PORT NUMBER
redis-cli ping