GCP Cloud Functions start and stop VMs

Contents

Summary

In many cases you want to start or stop a VM instance in GCP very quickly. You can do this by using Cloud Functions and a few lines of Python.

In this article I’ll be showing you how you can do that with a very easy and simple to follow instructions.

The idea behind this was that I wanted to easily let my family start and stop the small Minecraft server that I have built for us, so that any time the kids want to play, the server can be started easily without anyone logging into the Cloud Console.

So I thought of finding a way to let them just hit a simple URL which in turn will do the job. That’s where Cloud Functions on GCP come in.

So in this article, I’ll be showing you the following:

  • The prerequisites prior to setting up your Cloud Function.
Read the rest “Start and Stop VMs in GCP Using HTTP Triggered Cloud Functions with Python”

Intro

GCP or Google Cloud platform offers many services to customers. One of the fundamental services in GCP is the GCE, or Compute Engine.

Compute Engine is the service that allows you to run and deploy your workloads through the IaaS approach. One of the key benefits of IaaS is the ease and flexibility of resource deployment and management.

Snapshots are an important part of the service. They allow you to easily capture the whole VM state before doing any modification… Before a while, there was no option to automate the snapshot creation process without using Google Cloud SDK or gcloud command line tools.

Usually the way we used to do that is by creating a cron job, or a scheduled task that will run gcloud command and then create the snapshot. More automation involved managing the snapshots retention period from inside the script we ran from that cron … Read the rest “Enable snapshot schedules in GCP Compute Engine!”