SSH via IAP tunnel

Reach a VM with no public IP through Identity-Aware Proxy; no bastion needed

gcloud compute ssh <name> --zone <id> --tunnel-through-iap

tool
gcloud8 commands
tags
gcloudnetworksecuritycloud

More gcloud commands

  • gcloud secrets versions access latest --secret=<name> --project <id>

    Print latest Secret Manager version to stdout; pin a version in CI for repeatability

  • gcloud storage rsync -r -d ./build gs://<name>/site

    Mirror dir to GCS; -d deletes extras, modern replacement for gsutil rsync

  • gcloud auth activate-service-account --key-file=key.json && gcloud config set project <id>

    Auth as SA in CI; note: prefer workload identity over long-lived key files

  • gcloud container clusters get-credentials <cluster> --region <id> --project <id>

    Fetch GKE kubeconfig; modern: needs gke-gcloud-auth-plugin in PATH since k8s 1.26

  • gcloud compute instances list --format="table(name,status,EXTERNAL_IP)" --filter="status=RUNNING"

    Custom table of running VMs and public IPs via --format/--filter projections

all 8 gcloud commands