Disk Image in Compute Engine



Public images are managed by Google, which is available to use when we spin up a new VM instance in the compute engine. There is another type of image in GCE called local images, which are available only at the project level. 

Images are useful for creating multiple instances when you customized the instance in a certain way. For instance, you could have configured the latest software updates, application-specific settings, and other custom operations related to the application that you would not want to rework for another new instance when you create. 

Characteristics of Disk Image

  • One backup per instance
  • Always full backup not incremental oriented
  • Multi variant images will incur more billing 
  • Useful for maintaining up-to-date configurations

Create an image through the web console


Go to images and select create a new image in the compute engine

datacloudies disk image

Select the source disk, location where it requires to store the image. As mentioned the console instance will be turned off during the image backup which is the optimal way of creating a consistent image. 

The source type could be a disk/ image/ cloud storage file or any specific VM format type. Select the appropriate type based on the requirement. 




Create an image using the command-line tool


gcloud compute images create datacloudies-2 --source-disk datacloudies-2 \
--source-disk-zone us-central1-a --family debian-9

Make sure to stop the running instance as we are taking the consistent image backup of the boot disk.

datacloudies disk image

Verify the image details in the dashboard as well

datacloudies disk image



Similarly if you want to create an image from another image, then change the source type as image and the remaining flags are the same. 



datacloudies disk image

Equivalent command line for creating the image from another image,

gcloud compute images create image-1 --project=spartan-metric-267403 \
--source-image=datacloudies-2 --source-image-project=spartan-metric-267403 \
--storage-location=us

I hope you have enjoyed this tutorial. Please feel free to check other articles in the cloud branch. Thank you!




Recent Posts