2.2. Create a VM Two Ways#

This lab demonstrates how to do some basic work in Google Cloud Console. The console is where a lot of basic tasks get done in Google Cloud, so it’s important to be able to navigate around. This is review for students that have taken CIS-91.

Warning

Don’t fail to delete your VMs as shown at the end of this lab.

They are expensive.

Way 1: Using the GUI#

In class I demonstrate how to create and connect to a VM in Google Cloud. The demo follow the official tutorial from Google at the link below:

Way 2: The gcloud Command#

Google shows you how to do equivalent tasks using the gcloud command when you do things in the Web UI. The commands you get from the UI are pretty complicated because they show every setting. Here’s a simplified command that creates a VM for you:

$ gcloud compute instances create my-debian-vm \
  --machine-type=e2-small \
  --image-family=debian-12 \
  --image-project=debian-cloud \
  --zone=us-central1-a

Now let’s take a look at your VMs:

 gcloud compute instances list
NAME          ZONE           MACHINE_TYPE  PREEMPTIBLE  INTERNAL_IP    EXTERNAL_IP   STATUS
instance-1    us-central1-a  e2-small                   10.128.15.211  34.67.78.161  RUNNING
my-debian-vm  us-central1-a  e2-small                   10.128.15.212  34.67.78.160  RUNNING

The gcloud command makes it really easy to SSH into your VMs by managing keys for you:

$ gcloud compute ssh my-debian-vm
No zone specified. Using zone [us-central1-a] for instance: [my-debian-vm].
Warning: Permanently added 'compute.8533307478500148725' (ED25519) to the list of known hosts.
Linux my-debian-vm 6.1.0-42-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.159-1 (2025-12-30) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

mike@my-debian-vm:~$ 

To get back to your dev environment you should exit your SSH session:

mike@my-debian-vm:~$ exit
logout
Connection to 34.67.78.160 closed.

You can turn on and off, reboot and delete your VMs from the command line as well. Let’s delete the VMs we just created so we don’t spend too much money:

$ gcloud compute instances delete my-debian-vm
$ gcloud compute instances delete instance-1