How To Create custom Image in Google Compute Engine (GCP)

Reading Time: 4 minutes

In this tutorial you will learn to create custom image in google compute engine from virtual machine instance and improve VM launch time using Instance templates with custom images in Google Cloud platform.

How to create a custom image in Google Compute Engine

Prerequisite: This is step by step tutorial and you can follow along. You would need access to google cloud platform and cloud services. Google cloud offers google cloud free trial account with free credits worth 400 $ to be spend over 90 days of period. To learn more about creating your first free trial account refer Google Cloud Free Credits – Google Cloud Tutorials.

Visit https://console.cloud.google.com/ in your browser and log in with your free trial account.

It is recommended to create a new GCP project for create machine image gcp demo. At the end of the demo, we will delete this project. This will ensure that all cloud resources created as a part of demo are deleted and there are no recurring charges.

Google Cloud Free trial account supports maximum of 22 projects at given point in time.

In projects tab click on new project.

new project

Enter valid project name and click on create.

There is no organization associated with individual google cloud accounts.

Search “compute engine” in cloud console search box and enable Compute Engine API.

In left navigation under VM instances click on create new VM instance.

In this tutorial we will create virtual machine with default configuration.

To learn more about virtual machine family, Sofware configuration and advance options refer Set Up GCP Free VM In 10 Minutes – Google Cloud Tutorials.

vm configuration

Review virtual machine configuration and click on create.

It will take couple of minutes to new virtual machine in google cloud.

Once the virtual machine is ready status will turn to green and if it is configured to use as web server it will have internal and external IP addresses.

running instance

It is recommended to stop running virtual machine instance before creating Google cloud custom Image in Compute Engine.

In Compute Engine under storage click on storage tab.

Create a new Image and select source as DISK.

Create custom Image in Google Compute Engine

Enter a valid image name.

In source disk select virtual machine name.

 Specify where to store the machine image. Choose between Multi-regional or Regional storage.

Google cloud storage always encrypts data on server data before it is saved. It used to google managed encryption key. To learn more about cloud storage encryption options refer Google Cloud Storage Encryption – Cloud KMS – Google Cloud Tutorials.

Create GCP Instance Template using custom Image

GCP Instance Template is global resource used to manage virtual machine set up and configuration.

It greatly simplifies configuration and time required to launch multiple virtual machines.

In Compute Engine under instance templates click on create a new instance template.

Specify instance template name and labels as per requirment.

In boot disk configuration select custom images options.

Google cloud offers 2 different types of Images.

Public Images: Provided and maintained by google and open-source communities.

Custom Image: Created by you for your project.

Select custom image created in step 1 and click on create.

custom image boot disk

Once boot disk image is selected, we will use default configuration for other settings in instance template.

To learn more about GCP Instance template refer Create GCP Instance Template In 2 Minutes – Google Cloud Tutorials.

Create a Virtual Machine from custom Image in GCP

In Google cloud console search for “Compute Engine”.

Navigate to Instance template tab.

You should see instance template created in step 1.

Right click on 3 dots and click on create VM.

Review instance template name.

Review custom image in boot disk tab.

boot disk virtual machine

Review another virtual machine configuration and click on create.

A new VM instance would be launch using custom images and GCP instance template.

The same Instance template can also be used to create MIG.

At the end of demo remember to delete GCP project. If you are using existing GCP project delete MIG,virtual machines, Instance template and Images to prevent recurring charges from google cloud.

To learn more about storage and image pricing in google cloud platform refer Disk and image pricing  |  Compute Engine: Virtual Machines (VMs)  |  Google Cloud.

FAQ – custom Image GCP

How do I upload a custom image to Google Cloud?

To create a custom image for virtual machine in GCP search “Compute Engine” in cloud console.
In left navigation under storage click on images.
Click on create image and refer step 2 of this article.

What is custom image in Google Cloud?

You can create custom images from source disks, images, snapshots, or images stored in Cloud Storage.
Custom Images can be used to create Instance templates which can be used to create a virtual machine or MIG.
You can also create virtual machine directly from Image.

Which tool can we use to create custom image on GCP?

Custom images can be created in GCP using google cloud console or cloud command line utility.

Scroll to Top