Skip to content

Instantly share code, notes, and snippets.

@hradec
Forked from jibs/gcloud-port-forward.md
Created August 19, 2021 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 hradec/314465e974c8a2d68ca8d1091de796a1 to your computer and use it in GitHub Desktop.
Save hradec/314465e974c8a2d68ca8d1091de796a1 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