A Free Virtual machine

Share on:


Did you know the lovely providers of cloud have a free tier? Have you wanted to take advantage but not sure where to start?

Free stuff - do go on:inline

If you are not familiar with the Free Tier offerings it can be worth your time to take a look. Below are the main cloud providers you may have heard of:


In this blog post learn how to create a virtual machine on Google Cloud. Once the machine is created add a simple application and run it from your free virtual machine. For the purposes of demonstration I will stick with the Free Tier. Feel free to update the machine specification to your own requirement once you are comfortable with the build process.

NOTE: Dont forget to Stop or Delete your machine once you are done experimenting

Compute Specification

Google Cloud Free tier includes virtual machines (i.e. Compute Engine) so lets check what is available.

  • Machine Type: f1-micro
  • CPU: 1 vCPU
  • RAM: 614 MB
  • Region: US
  • Disk: 30GB
  • GPU: N/A
  • TPU: N/A
  • 1GB Network Egress

Build a Server

Ubuntu 18.04 LTS will be the operating system used for this example. Disclaimer: Other operating systems exist and can be used However for the sake of this example the choice is not my main priority. Generally Ubuntu has great support and is perfect for tutorials based on its default installation.

Building a remote server typically has the following steps:

  • Create a Virtual Machine based on the above specification
  • Add Firewall rule for TCP:80 (HTTP) traffic
  • Add Firewall rule for TCP:443 (HTTPS) traffic
  • Add Firewall rule for TCP:8080 traffic

The firewall is important as this will be present to stop unauthorized traffic to your host machine.

For those of you following along on Google Cloud. Below are the command line options for Cloud Shell

  1. Create a Ubuntu VM on Google Cloud:
1gcloud beta compute --project=$GOOGLE_CLOUD_PROJECT instances create virtual-host --zone=us-central1-a --machine-type=f1-micro --subnet=default --network-tier=PREMIUM --maintenance-policy=TERMINATE --scopes=https://www.googleapis.com/auth/cloud-platform --tags=http-server,https-server,virtual-host --image=ubuntu-1804-bionic-v20210604 --image-project=ubuntu-os-cloud --boot-disk-size=10GB --boot-disk-type=pd-balanced --boot-disk-device-name=virtual-host --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --labels=user=richrose --reservation-affinity=any
  1. Add Firewall Rules (HTTP/TCP:80)
1gcloud compute --project=$GOOGLE_CLOUD_PROJECT firewall-rules create default-allow-http --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:80 --source-ranges= --target-tags=http-server
  1. Add Firewall Rules (HTTPS/TCP:443)
1gcloud compute --project=$GOOGLE_CLOUD_PROJECT firewall-rules create default-allow-http --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:80 --source-ranges= --target-tags=http-server
  1. Add Firewall Rules (TCP:8080)
1gcloud compute --project=$GOOGLE_CLOUD_PROJECT firewall-rules create default-allow-app1 --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:8080 --source-ranges= --target-tags=virtual-host

The virtual machine will take a minute to create and then be quickly followed by firewall rule updates.

Google Cloud Virtual Machine instance:inline

Based on the above config you will now have a virtual machine instance.

In particular note the virtual machine has:

  • An Internal IP
  • An External IP
  • SSH connectivity
  • REGION set as us-central1
  • Status indicated by a green tick - meaning the instance is active

NOTE: Virtual machine instances can be Stopped or Deleted. If you intend to reuse the instance, stopping then restarting the instance can be a convienient option.

Now we have a virtual machine we should probably do something with it.

Example - Hugo Static Site Generator

Even though the virtual machine is quite small it is quite capable. To test it out lets install and run a blog on our new remote machine.

Open a new SSH connection to the virtual machine and configure it as follows:

  1. Add an environment variable
  1. Download the Hugo archive
1wget https://github.com/gohugoio/hugo/releases/download/v${version}/hugo_extended_${version}_Linux-64bit.deb
  1. Install Hugo
1sudo dpkg -i hugo_${version}_Linux-64bit.deb
  1. Generate a blog with Hugo
1hugo new site roselabs-blog
  1. Move to the blog directory
1cd roselabs-blog
  1. Add a theme
1git clone https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
  1. Create an Example post
1hugo new posts/roselabs-first-post.md
  1. Run the Hugo server on TCP:8080
1hugo server --bind --port 8080

NOTE: We opened the above port in the firewall. The hugo application will therefore be accessible.

Now go the external IP address of the virtual machine created. Enter


You will see your new blog in all its awesome glory.

Hugo blog running on Google Cloud:inline


Creating a virtual machine on a remote provider is much easier than repurposing an old machine. All the parts are made available to you and spinning up the resource is made as simple as possible.

Our example machine is pretty small but it can be used for a variety of tasks. Having a small virtual machine is the perfect way to tinker with technology. Best of all its free if you keep within the limits set by the provider!


Once you have finished testing your machine.

  • Stop any resources that are no longer required
  • If you intend to reuse a resource on an ongoing basis - Setup a Billing alert!