Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  GCLOUD_COMPUTE_SSH (1)


gcloud compute ssh - SSH into a virtual machine instance



gcloud compute ssh [USER@]INSTANCE [--command COMMAND] [--container CONTAINER] [--dry-run] [--plain] [--ssh-flag SSH_FLAG] [--ssh-key-file SSH_KEY_FILE] [--zone ZONE] [GLOBAL-FLAG ...] [-- IMPLEMENTATION-ARGS ...]


gcloud compute ssh is a thin wrapper around the ssh(1) command that takes care of authentication and the translation of the instance name into an IP address.

This command ensures that the user’s public SSH key is present in the project’s metadata. If the user does not have a public SSH key, one is generated using ssh-keygen(1) (if the --quiet flag is given, the generated key will have an empty passphrase).



Specifies the instance to SSH into.

USER specifies the username with which to SSH. If omitted, $USER from the environment is selected.

Flags and positionals passed to the underlying ssh implementation.

The ’--’ argument must be specified between gcloud specific args on the left and IMPLEMENTATION-ARGS on the right. Example:

$ gcloud compute ssh example-instance --zone us-central1-a -- -vvv \
-L 80:%INSTANCE%:80


--command COMMAND

A command to run on the virtual machine.

--container CONTAINER
The name of a container inside of the virtual machine instance to connect to. This only applies to virtual machines that are using a Google container virtual machine image. For more information, see

If provided, prints the command that would be run to standard out instead of executing it.

Suppresses the automatic addition of ssh(1)/scp(1) flags. This flag is useful if you want to take care of authentication yourself or re-enable strict host checking.

--ssh-flag SSH_FLAG
Additional flags to be passed to ssh(1). It is recommended that flags be passed using an assignment operator and quotes. This flag will replace occurences of %USER% and %INSTANCE% with their dereferenced values. Example:

$ gcloud compute ssh example-instance --zone us-central1-a \
--ssh-flag="-vvv" --ssh-flag="-L 80:%INSTANCE%:80"

is equivalent to passing the flags --vvv and -L 80: to ssh(1) if the external IP address of 'example-instance’ is

--ssh-key-file SSH_KEY_FILE
The path to the SSH key file. By default, this is ~/.ssh/google_compute_engine.

--zone ZONE
The zone of the instance to connect to. If not specified, you will be prompted to select a zone.

To avoid prompting when this flag is omitted, you can set the compute/zone property:

$ gcloud config set compute/zone ZONE

A list of zones can be fetched by running:

$ gcloud compute zones list

To unset the property, run:

$ gcloud config unset compute/zone

Alternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE.


Run $ gcloud help for a description of flags available to all commands.


To SSH into ’example-instance’ in zone us-central1-a, run:

$ gcloud compute ssh example-instance --zone us-central1-a

You can also run a command on the virtual machine. For example, to get a snapshot of the guest’s process tree, run:

$ gcloud compute ssh example-instance --zone us-central1-a \
--command "ps -ejH"

If you are using the Google container virtual machine image, you can SSH into one of your containers with:

$ gcloud compute ssh example-instance --zone us-central1-a \
--container CONTAINER
Search for    or go to Top of page |  Section 1 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.