Automatically Backup Google Cloud VM (with screenshots)

To ensure your Google Cloud VM Instance data’s safety, you should backup your VM regularly. In this tutorial you will learn to create back up of your Google Cloud VM Instances. 

How to back up Google Cloud VM instances?

On Google Cloud Platform The backup procedure is slightly different. To take back up of Your VM you will be creating persistent disk snapshots. Though there is another way, by creating Image of your whole instance you also can create backups. But that said, it is not a recommand way of taking backups because Images are primarily used to create boot disks for instances or to configure the boot disks for instance templates. 

Snapshots are incremental and automatically compressed, so you can create regular snapshots on a persistent disk faster and at a much lower cost than if you regularly created a full image of the disk. — Google Cloud.

How to automatically back up Google Cloud VM instances?

Recently Google introduced a new snapshot feature which is called “Snapshot schedules”, With Snapshot schedules you can create automatic backups for your VM instances.

How much it cost to back up Google Cloud VM instances?

Though the back up cost might also incur network fees based on the storage location of the snapshot but in most situations the cost is between $0.026-$0.035 per GB/month. 

I am also using schedules snapshot to back up my website. My website’s VM server is located in the USA (us-east1-b) and currently it has 3.30 GB of data, So I am paying around  (3.30×0.026) $0.0858 per month.

Explanation:

Before we start our tutorial let me explain the process.

Snapshots are incremental on GCP. It means, Only the first snapshot will contain all the data on the persistent disk. If you create a second snapshot that snapshot only contains any new data or modified data since the first snapshot. And Snapshot 3 contains any new or changed data since snapshot 2.

 If a snapshot has no dependent snapshots, then you can delete it outright. But if it has dependent snapshots then the data automatically get transfer to the next one.

So, Let’s get started,

Setting up Automatic backups

1. Log in to your Google Cloud account. On your Google Cloud  dashboard and click the hamburger menu in the upper left-hand corner of the screen.

2. After that, Navigate to Compute Engine >> Disks.

3. Now click over the name of your VM instance.

4. After that, from your right-hand top conner, click on “EDIT” to modify your disks settings.

5. Now, Scroll down to “Snapshot schedule”  and choose “Create schedule”.

6. Creating a new Snapshot Schedule,

  1. Name: It is your snapshot schedule name. Give any name as you wise.
  2. Leave it as default. If you don’t know about Region and Snapshot location then don’t change anything, it may incur network fees. 
  3. Schedule frequency – choose how often you want to take a backup from daily, weekly, hourly. Start time – at what time backup should be made. Here is link for GMT time converter.
  4. Autodelete snapshots after – how many last snapshots you want to keep at any time. Deletion rule – (very important) what should happen if you delete your VM instance(source disk). If you choose Keep snapshots: then your backups are retained permanently unless you delete them manually. If you choose “Delete snapshots older than * days then your backup get automatically deleted after * days. 

After that click on the Create button to save your new backup schedule.

Finally, click the save button to apply the changes.

Setting up Manual backups

1. On your Google Cloud  dashboard and click the hamburger menu in the upper left-hand corner of the screen.

2. After that, Navigate to Compute Engine >> Snapshots.

3. Then click on “Create snapshot” button.

4. Name: It is your backup (snapshot) name. Give any name as you wise.

5. After that, Scroll down to “Source disk” and choose your VM Instance (boot disk) from the list.

6. Leave Location as default. If you don’t know about Region and Snapshot location then don’t change anything, it may incur network fees. 

7. Finally, click on “Create” to generate a backup of your VM.

Here I created two backups (snapshots) of my usa-main-server. The first one contain a full backup of my server but the second only contains any new data or modified data since the first backup.

Now it is your time!

I tried my best to provide you a complete tutorial on how you can create backups of your VM instance on Google Cloud Platform. I hope you liked it.

If you need help just drop a comment.

If you benefited from this tutorial, and would like to support my work, please like my Facebook page.

Thanks