Reputation: 16691
How can I access the console of a Google Compute Engine VM instance?
Upvotes: 4
Views: 6102
Reputation: 13424
To see the console output (read-only), you can use any of the following methods:
gcloud compute instances get-serial-port-output
getSerialPortOutput
To get read/write (interactive) access, follow instructions on this page:
gcloud compute instances add-metadata [INSTANCE_NAME] \ --metadata=serial-port-enable=1
and then, per the same page, either connect via Google Cloud Console:
Go to the VM instances page.
- Go to the GCE VM instances page
- Click the instance you want to connect to.
- Scroll to the bottom of the page and look for the Serial port section.
- If you want to connect to a serial port other than the default serial port 1, click the down arrow next to the Connect to serial port button and change the port number accordingly.
- Click the Connect to serial port button to connect to port 1 by default. For Windows instances, pull down the dropdown menu next to the button and connect to Port 2 to access the serial console.
or, connect via gcloud
:
Use the
gcloud compute connect-to-serial-port
subcommand to connect using thegcloud
command-line tool. For example:gcloud compute connect-to-serial-port [INSTANCE_NAME]
where
[INSTANCE_NAME]
is the name of the instance for which you want to access the serial console.By default, the
connect-to-serial-port
command connects to port 1 of the serial console. If you are connecting to a Windows VM instance, connect to port 2 instead:gcloud compute connect-to-serial-port [INSTANCE_NAME] --port 2
To connect to any other port, provide a different port number using the
--port
flag. You can provide a port number from 1 through 4, inclusively. To learn more about port numbers, see Understanding serial port numbering.
Upvotes: 5
Reputation: 264
While this doesn't answer your direct question, if the reason you need physical console access is to troubleshoot why a system is inaccessible (i.e. it no longer boots or, because of a bad firewall configuration, you can no longer access it over SSH), your best bet is to:
Upvotes: 1