3

I have a VM instance on GCE that I've configured. It has all the library installations and source codes that I need for my project. Now for scaling issue, I'd like to make more VM instances running on exactly the same code to improve the performance.

To my understanding, there are two ways to do this. One is Creat an Image From Persistent Disk to reuse the disk state. The other way is to use Snapshots.

There doesn't seem to be any documentation explaining the differences and usages in different situations. I wonder which one should I use for my purpose. Thanks in advance.

J Freebird
  • 3,664
  • 7
  • 46
  • 81

2 Answers2

6

Persistent Disk Images can be exported and used outside the project. You can download it to your own computer if you wanted, so it is easier to make redundant copies in case someone accidentally deletes the image.

Snapshots are better for things like backups of your VM. They are differential, so if you take a new snapshot every week, you only pay for the difference.

Snapshots are cheaper in terms of storage cost, but there is a network fee if you use them across zones. I don't think images have this network fee.

I feel in this case, the Persistent Disk Image might be the better choice. They both should work, and I don't think using either is "wrong."

Here are some more links explaining the difference:

Google Compute Engine: what is the difference between disk snapshot and disk image?

GCE API for differential snapshots

Community
  • 1
  • 1
Sandeep Dinesh
  • 2,035
  • 19
  • 19
  • Thank you for your answer. But I think to make a disk image you have to terminate and delete the VM instance to which the persistent disk is attached, right? The instance is already set up and serving requests now and I don't want to terminate it. So I suppose in this case, I should use snapshots? Thanks. – J Freebird Jul 21 '15 at 01:08
  • You can create a snapshot, then create a disk from that snapshot, and then use that disk to make the image. After that, delete the snapshot and the disk. – Sandeep Dinesh Jul 21 '15 at 22:26
1

Sandeep's answer mentions most of the points, including Snapshots being cheaper. However as far as I have seen The cost is not that big of a factor when you decide between them as both of them cost very less per GB.

The major factor which the documentation highlights when deciding between them is the fact that you can use the disk image to create the instance at any zone without incurring any cost. In fact, I have used this feature to migrate a GCE instance from one zone to another.

0xC0DED00D
  • 19,522
  • 20
  • 117
  • 184