gcloud compute tpus queued-resources ssh [USER@]QR [--batch-size=BATCH_SIZE; default=64] [--dry-run] [--force-key-file-overwrite] [--node=NODE; default="0"] [--plain] [--ssh-flag=SSH_FLAG] [--ssh-key-file=SSH_KEY_FILE] [--strict-host-key-checking=STRICT_HOST_KEY_CHECKING] [--worker=WORKER; default="0"] [--zone=ZONE] [--command=COMMAND : --output-directory=OUTPUT_DIRECTORY] [--internal-ip | --tunnel-through-iap] [--ssh-key-expiration=SSH_KEY_EXPIRATION | --ssh-key-expire-after=SSH_KEY_EXPIRE_AFTER] [GCLOUD_WIDE_FLAG …] [-- SSH_ARGS …]
gcloud compute tpus queued-resources ssh my-qr --command="last boot"To run the same command in all nodes and workers in a Cloud TPU Queued Resource (with the default batch size), run:
gcloud compute tpus queued-resources ssh my-qr --command="last boot" --worker=all --node=allTo run the same command in all nodes and workers in a Cloud TPU Queued Resource but batching the request in groups of 4, run:
gcloud compute tpus queued-resources ssh my-qr --command="last boot" --worker=all --node=all --batch-size=4USER@]QR
specifies the username with which to
SSH. If omitted, the user login name is used.
USER
QR specifies the name of the Cloud TPU
Queued Resource to send SSH command to.
SSH_ARGS …]gcloud compute tpus queued-resources ssh example-instance --zone=us-central1-a -- -vvv -L 80:%TPU%:80--batch-size=BATCH_SIZE; default=64--worker flag, it executes the command concurrently in groups of
the batch size. This flag takes a value greater than 0 to specify the batch size
to control the concurrent connections that can be established with the TPU
workers, or the special keyword ``all`` to allow the concurrent command
executions on all the specified workers in --worker flag. Maximum
value of this flag should not be more than the number of specified workers,
otherwise the value will be treated as ``--batch-size=all``.
--dry-run--force-key-file-overwrite--node=NODE; default="0"--command
flag, it additionally supports a comma-separated list (e.g. '1,4,6'), range
(e.g. '1-3'), or special keyword ``all" to run the command concurrently on each
of the specified node(s).
Note that when targeting multiple nodes, you should run 'ssh-add' with your
private key prior to executing the gcloud command. Default: 'ssh-add
~/.ssh/google_compute_engine'.
--plainssh(1)/scp(1)
flags. This flag is useful if you want to take care of authentication yourself
or use specific ssh/scp features.
--ssh-flag=SSH_FLAGssh(1). It is recommended that
flags be passed using an assignment operator and quotes. Example:
gcloud compute tpus queued-resources ssh example-instance --zone=us-central1-a --ssh-flag="-vvv" --ssh-flag="-L 80:localhost:80"
This flag will replace occurences of
and %USER% with their dereferenced values.
For example, passing ``80:%TPU%:80`` into the flag is equivalent to passing
%TPU% to
80:162.222.181.197:80ssh(1) if the external IP address of 'example-instance' is
162.222.181.197.
--ssh-key-file=SSH_KEY_FILE~/.ssh/google_compute_engine.
--strict-host-key-checking=STRICT_HOST_KEY_CHECKINGSTRICT_HOST_KEY_CHECKING must be one of:
yes, no, ask.
--worker=WORKER; default="0"--command
flag, it additionally supports a comma-separated list (e.g. '1,4,6'), range
(e.g. '1-3'), or special keyword ``all" to run the command concurrently on each
of the specified workers.
Note that when targeting multiple workers, you should run 'ssh-add' with your
private key prior to executing the gcloud command. Default: 'ssh-add
~/.ssh/google_compute_engine'.
--zone=ZONEcompute/zone property isn't set, you might
be prompted to select a zone (interactive mode only).
To avoid prompting when this flag is omitted, you can set the
property:
compute/zone
gcloud config set compute/zone ZONEA list of zones can be fetched by running:
gcloud compute zones listTo unset the property, run:
gcloud config unset compute/zoneCLOUDSDK_COMPUTE_ZONE.
These arguments are used to run commands using SSH.
--command=COMMANDRuns the command on the target Cloud TPU Queued Resource's nodes and then exits.
Note: in the case of a TPU Pod, it will only run the command in the workers
specified with the --worker flag (defaults to worker all if not
set).
--output-directory=OUTPUT_DIRECTORYThe path can be relative or absolute. The directory must already exist.
If not specified, standard output will be used.
The logs will be written in files named {WORKER_ID}.log. For example: "2.log". At most one of these can be specified:--internal-ip--tunnel-through-iapThis flag must be specified to attempt to connect via IAP tunneling. If it is not set, and connection to a Cloud TPU VM without external IP address is attempted from outside the network, then the command will fail.
To use IAP tunneling, there must be firewall access to the SSH port for the IAP TCP IP address range for the network the TPU is created in. See the user guide for more details.
To learn more, see the IAP for TCP forwarding documentation.--ssh-key-expiration=SSH_KEY_EXPIRATION--ssh-key-expire-after=SSH_KEY_EXPIRE_AFTER--access-token-file,
--account, --billing-project,
--configuration,
--flags-file,
--flatten, --format, --help, --impersonate-service-account,
--log-http,
--project, --quiet, --trace-token, --user-output-enabled,
--verbosity.
Run $ gcloud help for details.
gcloud alpha compute tpus queued-resources ssh
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.