Skip to content

Instantly share code, notes, and snippets.

@rodrigoespinozadev
Forked from jibs/gcloud-port-forward.md
Created December 5, 2018 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodrigoespinozadev/c4f302d54918d9bade218ee72bbe6791 to your computer and use it in GitHub Desktop.
Save rodrigoespinozadev/c4f302d54918d9bade218ee72bbe6791 to your computer and use it in GitHub Desktop.
port forwarding with a google cloud instance

Google cloud's ssh command lets you pass standard ssh flags. To, for example, forward local port 8088 to port 8088 on a vm instance, all you need to do is:

gcloud compute  ssh --ssh-flag="-L 8088:localhost:8088"  --zone "us-central1-b" "example_instance_name"

Now browsing to localhost:8088 works as it would with standard ssh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment