The right backup strategy and tool for your GCP VM

Harish Sharma
3 min readApr 21, 2022

When you setup an VM with GCP there are multiple options that can be used for backing up your data. In article we will discuss that the different options available within GCP and recommended option.

For the use case of this backup strategy article, i am taking a LAMP server hosting websites and web application. For the scope of this article we are only considering backup tools available within GCP.

Factors for the backup tools..

Based on my personal experience i have listed 5 items that would help you choose right backup tools and strategy

1- Cost — this is dependent on the size of data you backing up. This is recurring cost, goal would be to keep it as low as possible.

GCP storage pricing here — https://cloud.google.com/storage/pricing

GCP Snapshot pricing here —

2- Ease of setup — backup schedule — How easy it is to setup the schedule. As this one time process, even if this is little time consuming, i am ok to spend few extra hours doing that.

3- Ease of restoring data — this is crucial, as in case of server crash or application failure, you would want to quickly restore your application.

4- Flexibility — Do i have flexibility to restore a part of data, for instance i just want to get back up on my database?

5- Retention Policy — For how long you would like to keep the old backups. I usually keep 14 backups in my backup strategy (when we are doing daily backups)

6- Frequency of backup- Depending how dynamic your application or websites. If the website or application data is not updated frequently then once a week is fine, where for more dynamic application it can be once a day.

GCP backup tools…

Now we will evaluate the different tools available against the 3 deciding factors discussed above. GCP provides you with

1- Snapshot — this basically allow you take snapshot of your complete hard disk attached to your VM. You can setup schedule and it will take snapshot of your disk at specified interval. This can all be done using the simple UI interface provided

Restoring data is equally simple, just create a new disk from the Snapshot, and just attach it to new VM (if want to pull any specific data from backup) or existing VM (to restore your application to previous known healthy state). Thats it!

But mind you as you are backup up the entire disk, it will more space and Snapshots are far more expensive as compared to other options we will discuss below.

2- VM to GCP storage — The second option is to backup your data (not entire disk) to GCP storage (comparable to AWS S3 bucket). There are few steps to it, that i will try to capture in another article but it should not take you more than 30mins to set it up.

The image below summarises the comparison.

I personally recommend and choose option#2 — VM to GCP storage due to its flexibility and cost. It worked and was best suited for my use case.

If you need help in choosing right strategy, do comment and i will try to answer your questions/queries.

--

--