Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using GUI for VM instance created in Google Compute Engine

I am a very basic user in Google Cloud Platform.

Is it possible to use a GUI of my VM instance ? I am currently using Centos7 VM.

like image 680
codingfreak Avatar asked Jul 09 '15 09:07

codingfreak


1 Answers

You can use VNC to connect to VMs on Google Compute Engine. Here's a detailed tutorial for how to set this up.

For added security:

  1. use a long, complex password (though note that VNC limits passwords to 8 characters)
  2. instead of opening up port 5901 to the Internet, consider using an SSH tunnel. This is more complex, and depending on your Internet connection, may slow down your graphics refresh rate, but will be more secure.

To use the alternative approach with an SSH tunnel, here are the differences from the tutorial you need to follow:

  1. don't open port 5901 in the Google Compute Engine firewall
  2. create an SSH tunnel from your desktop/laptop to GCE VM via:

    gcloud compute ssh \
        ${VM_INSTANCE} \
        --project $PROJECT \
        --zone $ZONE \
        --ssh-arg "-L ${LOCAL_PORT}:localhost:5901"
    

    where you need to provide the right parameters for ${VM_INSTANCE}, $PROJECT, and $ZONE that match your configuration. You can choose ${LOCAL_PORT} to be 5901 if you wish, but if you decide to VNC into several different GCE VM instances, you'll have to choose unique ports for your local machine.

    You need to keep this connection open to use VNC. If this connection is closed, you will lose VNC access as well.

  3. Instead of connecting to your VM using its external IP, connect via localhost:${LOCAL_PORT} with ${LOCAL_PORT} same as selected earlier in step #2

like image 141
Misha Brukman Avatar answered Oct 07 '22 01:10

Misha Brukman