How I got practical experience in Google Cloud

Right, so how did I get practical experience in Google Cloud?

When I was studying for my cert I wanted to get as much hands on experience as I could, so I setup a task for myself which involved creating a game server for my friends that would setup hourly backups as well as monitoring.

I’m hoping this post will give you an idea on how you can get hands on experience as well.

So below I’m going to break down the steps I did and what I learned from each one, and apologies for my horrible grammar.

Creating the server

So the first step was creating the server, now the reason I wanted to setup a game server which in this case is a Minecraft server is because it will have a good load of network traffic as well as being resource heavy, so it’s a good server to gain some good metrics from.

I followed a guide on creating the server that can be found here.

Learning points

  • How to create a server in Google Cloud with an additional drive
  • Creating a Firewall rule to allow a specific port
  • How to SSH into your server
  • How to format and mount an additional drive in Linux
  • How to keep a service running even after disconnecting from the server

Now you can see from just creating a game server, a fair bit was covered.


Now here comes the practical experience, because if you have been using the Cloud for awhile making a server is nothing new.

I wanted to use as many Google Cloud services as I could for this server, so I started off with wanting to backup my servers game data to a Google bucket every four hours (This is explained in steps in the guide mentioned above).

Now this required a Cron job to be setup on the server and then a bash script was created, and in the bash script is a part that uses the Google SDK to upload documents to your Google bucket.

    screen -r mcs -X stuff '/save-all\n/save-off\n'
    /usr/bin/gsutil cp -R ${BASH_SOURCE%/*}/world gs://[BUCKET_NAME]/$(date "+%Y%m%d-%H%M%S")-world
    screen -r mcs -X stuff '/save-on\n'```

Learning points

From just creating a backup I completed the following tasks;

  • How to create a cron job
  • How to create a bash script
  • What the Google SDK command is to upload data to a Google bucket
  • How to setup a lifecycle policy on a Google bucket

So once again, something that seems so simple has a lot of learning points.


This is where Stackdriver comes in, and if you were looking for a reason to use this service here it is.


The reason for using Stackdriver to monitor my server is that it allows me to create a dashboard with metrics so I can get a deeper understanding on how my server is performing. For example;
From this dashboard we can see the CPU, Memory, disk and network performance all in one place. (Note: For you to get better reporting from your server, install the stackdriver agent.)


Since my server has been running for awhile now I can use these metrics to help save costs as well as optimise my server, I’ll show you a good example of that now.
The chart above is the CPU utilization over the period of one week, and you can see where my friends have been on the server which is demonstrated by the spikes. Now we can tell that the server has never gone above 30% so here’s a chance for us to save some money by downgrading the CPU from 2 to 1.


Another chart we can look at is memory.
We can see here that the memory utilization for the server has been increasing over the period of one week, no changes should be made here but we should be keeping an eye on this, and a good way to do that is via policies.


Another key service you should be playing with is policies, this is always used in the real world, as it allows you to know about potential problems before they happen.


Here you can see three policies I setup to keep track of my server, if any of these are triggered I will receive an email like this.


And if you set it up you can get daily updates on how your server is doing which look like this.


Learning Points

  • How to create a dashboard in Stackdriver
  • How to optimise and save costs using metrics
  • Understand what normal looks like for your server (This is important)
  • How to create policies in Stackdriver.
  • How to install a Stackdriver agent on your server.


As you can see, it can be easy to get hands on practical experience in Google cloud. Now just a note you don’t need to create a game server, you can create a blog / web server or anything but a web server / game server will provide some good metrics.

Also remember that Google give you $300USD to play with as well as free tier services as well, more info on those can be found here, but remember to setup budget alerts so you don’t blow through your credits.

Below is a video that explains it as well if a video is more your style.

Now how do you expand on this?

  • Try do everything you did manually via Terraform or Googles Deployment Manager
  • Try and get your server running as efficient as possible, using Stackdriver to help you.
  • Can you gain insights from the data you have been backing up via Bigquery?
  • How can you go about removing any personal information from your data. In my case I have public IPs and email addresses in my data.
  • Can you run this via Kubernetes or docker?

I hope you found this useful, and let me know if you have any questions in the comments below 🙂


Written on July 25, 2019