Compute

Compute Engine instance creation made easy with machine images

GCP Compute

Today, we’re pleased to introduce machine images, a new type of Compute Engine resource that contains all the information you need to create, backup or restore a virtual machine, reducing the amount of time you spend managing your environment.

If you administer applications that run on Compute Engine, you probably spend a lot of time creating images that you can use to create new instances. But even though Compute Engine features like custom images capture necessary information like disk data, you still need to manually capture instance configuration and metadata to create a new virtual machine. Machine images eliminates these extra steps and streamlines your operations. 

How are machine images different from images?

Custom images capture the contents of a single disk, for example, a boot disk, which can be used to create new instances that are preconfigured with the apps that you need, so that you don’t have to configure public images from scratch. 

Machine images are a more comprehensive resource that can contain multiple disks, as well as all of the information required to capture and create a new instance, including:

  • Instance properties (machine type, labels, volume mapping, network tags)

  • Data of all attached disks (one or multiple)

  • Instance metadata

  • Permissions, including the service account used to create the instance

Together, the additional information contained in a machine image not only simplifies image creation, but it also lays the foundation for a number of advanced capabilities.  

A better backup solution

Backing up an instance requires more than just disk data. To recreate an instance you need instance properties like the machine type, network tags, labels, and more. Capturing this information is easier with machine images. When you create a machine image from an instance, it stores the instance information and disk data into a single resource. When it comes time to restore the instance, all you need to do is provide the machine image and a new instance name. Machine images can be created whether the source instance is running or stopped. 

In addition to storing complete instance properties and data, machine images use the same differential disk backup technology that powers incremental snapshots, giving you fast, reliable and cost-effective instance backups. 

On top of existing incremental snapshots, machine images guarantee crash-consistency across all the attached disks at a given point in time. 

Compute Engine lets specify the storage location for your machine image disk data.This may help you meet availability or compliance goals. For example, choosing a multi-region such as ‘US’ ensures that the data is safe in multiple copies across multiple zones. Similarly, you can choose a single region to restrict the disk data to a particular region.

Machine image as golden image

Imagine that you’ve created and configured an instance as part of your web application, and you want to use it as the basis of other instances. With machine images, you can capture your web application exactly as you want it and save it as a golden machine image. You can then use that machine image to launch as many instances as you need, configured in the exact same way as your source instance. You can also share the machine image with other projects. If you need to change the properties of your new VMs, you can define new instance properties using machine images’ override functionality.

For replication use cases, we recommend creating a machine image from a stopped instance, which guarantees system integrity and performs OS generalization (i.e., Windows Sysprep). To learn more about best practices for creating machine images for replication purposes, including Windows VMs, visit the documentation.

Getting started with machine images

You can start using machine images via the Cloud Console, gcloud or the API. Let’s look at how to create a machine image from an instance from the console. First, visit the new ‘Machine images’ option from the left navigation bar in the Compute Engine console. Then select “Create a machine image” from the menu. In this case, we’re creating a machine image of an application server.

gcp compute machine image.jpg

To create an instance from a machine image, you can either create it directly from the Machine images page, or from the instance creation page by selecting the “New VM instance from machine image” option from the left menu.

gcp compute machine image 2.jpg

Get started with machine images today by visiting Compute Engine Cloud Console. The new machine images make it easy to create new instances at the heart of your scalability, backup and disaster recovery strategy. To learn more about machine images, including pricing information, visit the documentation.