Search code examples
portforwardingssh-tunnelgoogle-cloud-dataprocgoogle-cloud-datalab

Failed when followed instruction to setup SSH tunnel for Datalab in Dataproc


I created a Google Dataproc cluster with Datalab installed. Then I followed the instruction to set up the SSH tunneling. But I got an error. I also tried other ports. Got the same error. Not sure why. I was wondering if anything wrong with command.

Here is my command:

gcloud compute ssh --zone us-central1-a hnp-spark-cluster-44de-m -- -4 -N -L port:hnp-spark-cluster-44de-m:8081

Here is the error I got:

Bad local forwarding specification 'port:hnp-spark-cluster-44de-m:8081'

ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].


Solution

  • Looks like you probably found a documentation typo; when using local port forwarding you need to specify a local port on the left-hand-side instead of the actual literal word "port", for example, choose 1234:

    gcloud compute ssh ... -- -4 -N -L 1234:hnp-spark-cluster-44de-m:8081
    

    Then you would access on localhost at port 1234.

    I can't seem to find which docs you're looking at, since both https://cloud.google.com/dataproc/docs/tutorials/dataproc-datalab and https://cloud.google.com/dataproc/docs/tutorials/jupyter-notebook recommend dynamic port forwarding instead; do you have a link to where you're getting the documentation with local port forwarding?