Skip to content

Instantly share code, notes, and snippets.

@theclanks
Forked from jibs/gcloud-port-forward.md
Created June 2, 2022 03:51
Show Gist options
  • Save theclanks/7623c3dc53b34c0904c90706541e1f59 to your computer and use it in GitHub Desktop.
Save theclanks/7623c3dc53b34c0904c90706541e1f59 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