Introduction
In this article, we will deep dive into custom Images and understand how we can improve VM launch time using custom images.
We would also understand how to create a VM instance template using a custom image.
In this article, we will cover the following topics:
- Create Custom Image
- Create VM instance using custom Image
- Create VM Instance template using custom Image
Prerequisites
In this article, we would not cover step-by-step VM creation since it was already covered in the previous 2 articles.
Installing OS patches and software at start up increases the initial load time of VM creations.
In this scenario custom Images can be mages can be very helpful.
Advantages of Using Custom Images
- Images can be deprecated when not in use
- Images can be shared across projects
- Images can be created using preconfigured VM instance meeting all required security standards
- Lesser load times as compared to start up scripts
Create Custom Image
To create a custom Image, we would first need to create a standard VM that adheres to all security standards.
We can also add start up script files for the installation of the Apache server
Kindly refer to previous articles to understand step by step process for VM Creation.
Once the VM Instance is created navigate to the disks under storage.
OS and software information of VM Instance is stored on disks.
Note
It is important to stop the VM instance before creating an Image.
Right-click and fill in all the required details for image creation.
Once the Image is created it is visible under the public Image repository.
Create VM instance using custom Image
Navigate to VM instances and click on the new VM instance.
Fill in all the required details and click on Boot Disk. Navigate to Custom Image Repository and select our Image.
Click on create and wait for our VM instance to launch.
Copy the External IP Address and paste it into the browser window and you would see the Apache web server page.
Since Apache web server installation is now part of Image itself there is no time wasted during launch to execute it on start up.
This greatly improves the launch time.
Create VM Instance template using custom Image
If we want to spin up multiple VM instances an instance template is a great option.
Navigate to VM Instance template and click on create instance template.
Enter all the required details and under boot disk select our custom image and click on create.
Using these instance templates, we can spin up multiple VM Instances.
Summary
In this article, we have learned how to work with custom images and create VM machines and Instance templates using the same.
This completes 4-part article series of working with Google compute Engine.
In the upcoming articles, we would see how to work with VM instance group and load balancer in Google Cloud Platform.
Thanks a lot for reading. I hope you liked this article. Please share your valuable suggestions and feedback. Write in the comment box in case you have any questions. Have a good day!