Machine images

This page describes what a machine image is, when to use it, and how it compares to other resources that store data such as snapshots or custom images. For information about creating a machine image, see Creating machine images.

A machine image is a Compute Engine resource that stores all the configuration, metadata, permissions, and data from one or more disks required to create a virtual machine (VM) instance. You can use a machine image in many system maintenance scenarios, such as instance creation, backup and recovery, and instance cloning.

When to use a machine image

The following table compares the use of machine images, persistent disk snapshots, instance templates, and custom images.

Scenarios Machine image Persistent disk snapshot Custom image Instance template
Single disk backup Yes Yes Yes No
Multiple disk backup Yes No No
No
Differential backup Yes Yes No No
Instance cloning and replication Yes No Yes Yes
VM instance configuration Yes No No Yes

From the preceding table, you can see that machine images are the most ideal resources for the following use cases:

Disk backup

Machine images support both multiple and single disk backups. Disks are backed up as differential snapshots.

When a machine image is used to copy disks, Compute Engine guarantees that the data across disks is captured in a crash-consistent manner at a given time. Compute Engine uses globally consistent timestamps to ensure this guarantee. This consistency is critical if your VM instance is running and you want to ensure that the backup point across disks is maintained. When the backup point across disks is maintained, you can return to the same point in time across disks when you restore a machine image.

Multiple disk backup

Machine images are suitable for creating backups of all disks that are attached to a VM instance. A machine image can be used to backup multiple disks at a time to ensure that the data captured in the machine image is consistent across all disks. A persistent disk snapshot can only backup a single disk at a time.

Differential disk backup

Machine images store differential snapshots of your images. When you generate a machine image from a VM instance, the first machine image contains a full copy of all disk data. Subsequent images are stored as differential or incremental copies for better performance and space efficiency. This mechanism is similar to that used by persistent disk snapshots.

Instance cloning and replication

Machine images can be used to create instances. You can use machine image to make copies of an instance that contains most of the VM configurations of the source instance. These copies can then be used for troubleshooting, scaling VM instances, debugging, or system maintenance.

Information stored in a machine image

A machine image collects the following information from the source instance:

The following information from the source instance is not collected by a machine image:

  • Data in memory.
  • Data in local SSD. However, a machine image captures the device mapping of local SSDs.
  • Attributes that are specific to the source instance, such as the name or IP address.

Machine image storage location

To meet compliance needs, you might need to control where your data is stored. You can control where your machine image is stored geographically by specifying a storageLocation during the creation of your machine image. Machine images can be stored in either a Cloud Storage multiregional location, such as asia, or a Cloud Storage regional location, such as asia-south1.

By default, when creating a machine image from an instance, the machine image is stored in either the Cloud Storage multiregional bucket that contains the source instance, or the geographically closest Cloud Storage multiregional bucket to the source instance.

For example, if your source instance is stored in us-central1 your machine image is stored in the us multi-region by default. However, a default location like australia-southeast1 is outside of a multi-region. The closest multi-region is asia.

Regardless of where the machine image is stored, you can still access the machine image globally by setting the proper permissions.

What's next