Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Cloud Computing Last updated: September 6, 2022
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

You don’t have to bother about backup if you are hosting your website on shared hosting, as most of the hosting provider takes care of the backup for you.

However, when you migrate hosting to cloud-like Google Cloud or AWS, then there are a few things that you got to take care of yourself.

Backup is one of them!

Lately, I moved Geekflare to Google Cloud Platform and was looking for a one-click backup option, but unfortunately, it doesn’t exist.

After some research, I learned the backup procedure is slightly different, and I loved it. The good thing is, that you have full control over your backup.

There are multiple levels (application, configuration, logs, etc.) of backup, and in the following, I will talk about taking complete VM backup manually and automatically.

The term used to take a backup of Google Cloud is called “snapshot.”

Some of the advantages of a snapshot.

  • You can take a snapshot while a disk is attached to the instance – no downtime during backup
  • It’s differential instead of creating a full disk backup every time – it reduces the backup storage cost and fast operation

Manually using Google Cloud Console

Google cloud console has the option to take a snapshot of the disk, and it is easy.

  • Log in to Google Cloud and go to Disks under Compute Engine
  • Click on the disk name which is attached to the instance, and you want to take a snapshot
  • Click on “CREATE SNAPSHOT.”

Give the snapshot name and click Create

  • It will take some time (depending on the disk size), and once done, you will see them in the snapshots section.

This indicates VM disk backup is done. Whenever needed, you can use this snapshot to restore/create a new VM with the same state at the time of VM backup.

Automatically using Scripts

If your application has frequent changes and you would like to automate taking a snapshot regularly, then the following will help you.

I found this solution from

  • Log in to the instance which you want to take auto backup
  • Create a folder where you want to store the script file
  • Download the script file
  • Change the file permission to be executable
chmod 755
  • Test the script to ensure it works by manually executing a script

Once confirmed, it works manually, then configure crontab to run periodically

  • Following example to run daily at 05:00
0 5 * * * /opt/google-compute-snapshot/ >> /var/log/cron/snapshot.log 2>&1

A script will default and keep the snapshot for the last seven days. If you need to change this schedule, then edit the script file and change the value of OLDER_THAN=7

Automatically using Google Cloud Console

Google recently introduced these features, and I love it. Now, GCP has the option for you to schedule a disk snapshot from the console itself.

  • Go to Compute Engine >> Snapshots
  • Click on the Snapshot schedules tab and the following popup will appear. Click Create snapshot schedules
  • Enter the necessary information and click Create

Let’s explore some of the available options.

  • Region – select where you want to store your VM snapshot (backup)
  • Schedule frequency – choose how often you want to take a backup from daily, weekly, hourly
  • Start time – at what time should backup be made? Choose low peak hours.
  • Auto delete snapshots after – how many last snapshots do you want to keep at any time?
  • Deletion rule – what should happen if you delete the source disk (VM)

Once created, you should see them listed.


This indicates the snapshot schedule is ready to be attached to the disk.

  • Go to Compute Engine >> Disks
  • Select the disk where you want to enable the snapshot
  • Click edit and select the newly created schedule as shown below.
  • Click save

That’s all!

Google Cloud will take the snapshot based on the schedule.

You see, just spending a few minutes to set up a backup can be a lifesaver. On top of the snapshot, you should also consider enabling screenshot, which can help to know the VM state.

If you are interested in learning more then check out this GCP certification course.

  • Chandan Kumar
    As the founder of Geekflare, I’ve helped millions to excel in the digital realm. Passionate about technology, I’m on a mission to explore the world and amplify growth for professionals and businesses alike.
Thanks to our Sponsors
More great readings on Cloud Computing
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder