Friday, May 2, 2025

Google Cloud - How to Set Up a Virtual Machine on Google Cloud (Step-by-...

How to Set Up a Virtual Machine (VM) on Google Cloud: A Beginner-Friendly Guide

Setting up a virtual machine (VM) in the cloud can sound intimidating, but it's actually pretty straightforward—especially with Google Cloud. In this post, I’ll walk you step-by-step through how to spin up a basic VM on Google Cloud, from choosing your machine type to connecting via SSH. This guide is perfect if you’re just getting started or need a refresher.

Step 1: Log into Google Cloud Console

First things first: make sure you have a Google Cloud account. If you already have a Google account, signing up for Google Cloud is pretty seamless.

Once you're in, go to cloud.google.com and click Console in the upper-right corner. This opens up the main dashboard with all the tools Google Cloud offers.

Step 2: Navigate to Compute Engine

To create a VM, head to the Compute Engine section. This is where all virtual machines are managed. Click “Create Instance” to get started.

Step 3: Name Your VM and Select a Region

Start by naming your VM. For this tutorial, I named mine testmachine (note: it must begin with a lowercase letter).

Next, choose the region closest to you or your users—this affects speed and latency. I selected Northern Virginia. You can leave the zone as “automatic” unless you have a specific reason to set it.

Step 4: Choose a Machine Type

Google Cloud offers several categories of VMs:

  • General purpose

  • Compute optimized

  • Memory optimized

  • GPU-based

For basic use or learning purposes, stick with General Purpose. I recommend selecting the E2 series and adjusting the machine type to e2-micro, which is very affordable—around $7.99/month, depending on the region and month.

Step 5: Pick an Operating System

Under the “Boot Disk” section, click Change to select your OS. By default, it uses Debian, but I prefer Ubuntu, which is based on Debian and widely supported.

Select Ubuntu Minimal, stick with the default 10GB boot disk (you can increase this later if needed), and click Select.

Step 6: Allow Web Traffic (Optional)

In the Firewall section, check both:

  • Allow HTTP traffic

  • Allow HTTPS traffic

This is important if you plan to run a web server on your VM.

Step 7: Launch the VM

Scroll down and click Create. Google Cloud will start provisioning your instance. Once it’s ready, you’ll see a green checkmark under the Status column.

Step 8: Connect to Your VM

Click the name of your VM, then click SSH at the top of the details page. This opens a terminal directly in your browser.

Google Cloud automatically handles the SSH keys and authentication for you—no password needed. You’re now connected to your VM!

Step 9: Stop or Delete the VM (To Save Money)

If you're done using the VM, you have two options:

  • Stop the VM: Click the Stop button. This halts the machine without deleting it, so you can restart it later.

  • Delete the VM: Click the Delete button if you no longer need it.

Bonus Tip: Use Instance Schedules

Google Cloud lets you create Instance Schedules to automatically turn your VM on or off at set times—great for saving money if you only need it during certain hours.


Final Thoughts

That's it! You now know how to set up a VM on Google Cloud, choose your configuration, connect securely, and manage costs. Whether you're experimenting, developing, or running lightweight applications, this basic setup will get you off the ground quickly.

I'm Dean—thanks for following along. If you found this guide helpful, feel free to share or drop me a line with your questions or feedback.