Google compute Engine (GCE) - custom Image

B V AKASHB V AKASH
3 min read

In this lab we will launch our VM instance using custom image

Here we are going to use our previous lab template.

let's begin

custom image :- Basically, a custom image is the image we use to save the boot disk state. In our previous lab we used startup script to launch our web application. We don't want to lose that state. So, we can create a custom image for that boot disk.

there are two types of images for now in GCP:-

Public image :- There are some images that we have used in previous labs, which GCP provides, such as the following:- debian, Red Hat Linux, Ubuntu, Window Server, etc.

Custom image :- The custom image will be created by using our boot disk. By using that custom image we will create our VM instance.

Let's start with our lab.

Step 1 :- Make sure you stop the desired VM instance.

image.png

Step 2 :- On your left screen you should see storage under that click on images followed by click on create image. image.png

Step 3 :- Give a name for your custom image and Choose source as disk.

We chose disk because we want to create custom image from our boot disk.

image.png

Step 4 :- We have already created a VM template on our previous lab, we can use that template as our source disk. image.png

Note :- You can choose running instance to create custom image of your boot disk but it's not recommended as you can see in below image. because you might get corrupted image. So it's not recommended.

image.png

Step 5 :- For location select Regional for now and select your desired region.

mMsL1TiMZn.png

Step 6 :- Rest everything default and Click on create.

image.png

Step 7 :- your image will be created.

image.png

Step 8 :- Click on instance templates on your left screen, choose your instance template and click on action followed by click on create VM.

image.png

Step 9 :- Name your instance template according to your wish and Plus region.

image.png

Step 10 :- Scroll down and under Boot disk click on change.

image.png

Step 11 :- Go to custom image, Make sure you are in the right project under image choose your image which we have created before and finally, click on select.

image.png

Step 12 :- As you see we choose our custom image and Finally click on create.

image.png

Step 13 :- Once your instance up and running, Copy your instance external IP address and paste it on your web browser. Your web page should work.

image.png

Step 14 :- As you can see our startup script is working by using our custom image.

image.png

That's it, for now, we will continue further more in next blog.

Hope you liked it. Will see you on the next topic ๐Ÿ˜ƒ

Next topic

https://bvakash.hashnode.dev/google-compute-engine-gce-machine-image

0
Subscribe to my newsletter

Read articles from B V AKASH directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

B V AKASH
B V AKASH

I design, architect, and maintain hybrid cloud environments.