File: //snap/google-cloud-cli/396/help/man/man1/gcloud_compute_connect-to-serial-port.1
.TH "GCLOUD_COMPUTE_CONNECT\-TO\-SERIAL\-PORT" 1
.SH "NAME"
.HP
gcloud compute connect\-to\-serial\-port \- connect to the serial port of an instance
.SH "SYNOPSIS"
.HP
\f5gcloud compute connect\-to\-serial\-port\fR [\fIUSER\fR@]\fIINSTANCE\fR [\fB\-\-dry\-run\fR] [\fB\-\-extra\-args\fR=\fIKEY\fR=\fIVALUE\fR,[\fIKEY\fR=\fIVALUE\fR,...]] [\fB\-\-force\-key\-file\-overwrite\fR] [\fB\-\-location\fR=\fILOCATION\fR] [\fB\-\-port\fR=\fIPORT\fR;\ default=1] [\fB\-\-ssh\-key\-file\fR=\fISSH_KEY_FILE\fR] [\fB\-\-zone\fR=\fIZONE\fR] [\fB\-\-ssh\-key\-expiration\fR=\fISSH_KEY_EXPIRATION\fR\ |\ \fB\-\-ssh\-key\-expire\-after\fR=\fISSH_KEY_EXPIRE_AFTER\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fBgcloud compute connect\-to\-serial\-port\fR allows users to connect to, and
interact with, a VM's virtual serial port using ssh as the secure, authenticated
transport protocol.
The user must first enable serial port access to a given VM by setting the
\'serial\-port\-enable=true' metadata key\-value pair. Setting
\'serial\-port\-enable' on the project\-level metadata enables serial port
access to all VMs in the project.
This command uses the same SSH key pair as the \f5gcloud compute ssh\fR command
and also 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.
.SH "EXAMPLES"
To connect to the serial port of the instance 'my\-instance' in zone
\'us\-central1\-f', run:
.RS 2m
$ gcloud compute connect\-to\-serial\-port my\-instance \e
\-\-zone=us\-central1\-f
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
[\fIUSER\fR@]\fIINSTANCE\fR
Specifies the user/instance for the serial port connection.
\f5\fIUSER\fR\fR specifies the username to authenticate as. If omitted, the
current OS user is selected.
.RE
.sp
.SH "FLAGS"
.RS 2m
.TP 2m
\fB\-\-dry\-run\fR
If provided, the ssh command is printed to standard out rather than being
executed.
.TP 2m
\fB\-\-extra\-args\fR=\fIKEY\fR=\fIVALUE\fR,[\fIKEY\fR=\fIVALUE\fR,...]
Optional arguments can be passed to the serial port connection by passing
key\-value pairs to this flag, such as max\-connections=N or replay\-lines=N.
See
https://cloud.google.com/compute/docs/instances/interacting\-with\-serial\-console
for additional options.
.TP 2m
\fB\-\-force\-key\-file\-overwrite\fR
If enabled, the gcloud command\-line tool will regenerate and overwrite the
files associated with a broken SSH key without asking for confirmation in both
interactive and non\-interactive environments.
If disabled, the files associated with a broken SSH key will not be regenerated
and will fail in both interactive and non\-interactive environments.
.TP 2m
\fB\-\-location\fR=\fILOCATION\fR
If provided, the region in which the serial console connection will occur. Must
be the region of the VM to connect to.
.TP 2m
\fB\-\-port\fR=\fIPORT\fR; default=1
The number of the requested serial port. Can be 1\-4, default is 1.
Instances can support up to four serial ports. By default, this command will
connect to the first serial port. Setting this flag will connect to the
requested serial port.
.TP 2m
\fB\-\-ssh\-key\-file\fR=\fISSH_KEY_FILE\fR
The path to the SSH key file. By default, this is
\f5\fI~/.ssh/google_compute_engine\fR\fR.
.TP 2m
\fB\-\-zone\fR=\fIZONE\fR
Zone of the instance to connect to. If not specified and the
\f5\fIcompute/zone\fR\fR 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
\f5\fIcompute/zone\fR\fR property:
.RS 2m
$ gcloud config set compute/zone ZONE
.RE
A list of zones can be fetched by running:
.RS 2m
$ gcloud compute zones list
.RE
To unset the property, run:
.RS 2m
$ gcloud config unset compute/zone
.RE
Alternatively, the zone can be stored in the environment variable
\f5\fICLOUDSDK_COMPUTE_ZONE\fR\fR.
.TP 2m
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-ssh\-key\-expiration\fR=\fISSH_KEY_EXPIRATION\fR
The time when the ssh key will be valid until, such as
"2017\-08\-29T18:52:51.142Z." This is only valid if the instance is not using OS
Login. See $ gcloud topic datetimes for information on time formats.
.TP 2m
\fB\-\-ssh\-key\-expire\-after\fR=\fISSH_KEY_EXPIRE_AFTER\fR
The maximum length of time an SSH key is valid for once created and installed,
e.g. 2m for 2 minutes. See $ gcloud topic datetimes for information on duration
formats.
.RE
.RE
.sp
.SH "GCLOUD WIDE FLAGS"
These flags are available to all commands: \-\-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 \fB$ gcloud help\fR for details.
.SH "NOTES"
These variants are also available:
.RS 2m
$ gcloud alpha compute connect\-to\-serial\-port
.RE
.RS 2m
$ gcloud beta compute connect\-to\-serial\-port
.RE