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

Google Compute-EngineSnapshotDiskimage

Google Compute-Engine Problem Overview


I've been using both for my startup and to me, the functionality is the same. Until now, the instances I've been creating are only for computation. I'm wondering how GCE disk images and snapshots are different in terms of technology, and in which situation it is better to use one over the other.

Google Compute-Engine Solutions


Solution 1 - Google Compute-Engine

A snapshot reflects the contents of a persistent disk in a concrete instant in time. An image is the same thing, but includes an operating system and boot loader and can be used to boot an instance.

Images and snapshots can be public or private. In the case of images, public can mean official public images provided by Google or not.

Snapshots are stored as diffs (a snapshot is stored relative to the previous one, though that is transparent to you) while images are not. They are also cheaper ($0.026 per GB/month vs $0.050 for images) (Snapshots are increasing to $0.050/GB/month on October 1, 2022).

These days the two concepts are quite similar. It's now possible to start an instance using a snapshot instead of an image, which is an easy way of resizing your boot partition. Using snapshots may be simpler for most cases.

Solution 2 - Google Compute-Engine

Snapshots:

  • Good for backup and disaster recovery
  • Lower cost than images
  • Smaller size than images since it doesn't contain OS, etc.
  • Differential backups - only the data changed since the last snapshot is recreated
  • Faster to create than images
  • Snapshots are only available in the project they are created (now it is possible to share between projects)
  • Can be created for running disks even while they are attached to running instances

Images:

  • Good for reusing compute engine instance states with new instances
  • Available across different projects
  • Can't be created for running instances(unless you use --force flag)

Solution 3 - Google Compute-Engine

Snapshots are primarily targeting backup and disaster recovery scenarios, they are cheaper, easier to create (can often be uploaded without stopping the VM). They are meant for frequent regular upload, and rare downloads.

Images are primarily meant for boot disk creation. They optimized for multiple downloads of the same data over and over. If the same image downloaded many times, subsequent to the first download the following downloads are going to be very fast (even for large images).

Images do not have to be used for boot disks exclusively, they also can be used for data that need to be made quickly available to a large set of VMs (In a scenario where a shared read-only disk doesn't satisfy the requirements for whatever reason)

Solution 4 - Google Compute-Engine

Snapshot is a copy of your disk that you can use to create a new persistence disk (PD) of any type (standard PD or SSD PD). You can use the snapshot to create a bigger disk size, also you have the ability of creating the new disk on any zone you might need. Pricing is a bit cheaper for the provisioned space used for a snapshot. when used as backup, you can create differential snapshots.

When you use an existing disk to create an instance, you have to create the instance in the same zone where the disk exists and it will have the size of the disk.

When referring to images resources, is the pre-configured GCE operating system that you’re running (Centos, Debian, etc) and you can use the public images, available for all projects or private images for a specific project or create your own custom image.

Solution 5 - Google Compute-Engine

> A snapshot is locked within a project, but a custom image can be > shared between projects.

Solution 6 - Google Compute-Engine

I would like to add in the above answers that the snapshots can also be shared across the projects and it is a global resource just like images. Snapshots are different than images just on the basis of the bootability for instances and template instances.

Ref.: https://cloud.google.com/compute/docs/disks/create-snapshots Section: "Permissions required for this task"

Solution 7 - Google Compute-Engine

simply put - snapshot is basically the backup of the data in the disk also important point is they are differentially backed up (lesser size). used for backup and DR mostly.

Image is having backup of the OS as well , custom images are prepared to ensure some organizational policies as well.

In terms of cloud computing - Images are used to launch multiple instances with same configurations and snapshots are mostly for backup

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEmmanuelView Question on Stackoverflow
Solution 1 - Google Compute-EngineNacho ColomaView Answer on Stackoverflow
Solution 2 - Google Compute-EngineCanerView Answer on Stackoverflow
Solution 3 - Google Compute-EngineIgor BelianskiView Answer on Stackoverflow
Solution 4 - Google Compute-EngineMariluView Answer on Stackoverflow
Solution 5 - Google Compute-Enginevaquar khanView Answer on Stackoverflow
Solution 6 - Google Compute-EngineSubodh PushkarView Answer on Stackoverflow
Solution 7 - Google Compute-EngineSWAPNIL RAJView Answer on Stackoverflow