Understanding instance templates and custom images in Google cloud
In this post we will discuss about instance templates & Custom images in GCP. If you work for a major company, chances are that you will be creating similar type of virtual instance multiple times. It will use the same machine type, has the same start up script, uses the same image family etc… So, it is easy to create an Instance template.
To create an Instance template, follow the below steps.
- Navigate to compute engine & click on instance templates.
- enter a name for the instance template & select the machine type.Tem
- An instance template can be associated with a particular region, but it can also be Global.
- As we did earlier, use the startup script, allow http and click create.
Now, using this Instance template we can create as many virtual instances as we want. We just have to create a vm
Creating a Custom Image
You can create a custom image in gcp if you want to make the image the standard for all other VM’s that you would create in future, you can create a custom image.
- Navigate to Disks & see the instances you have currently present in the project.
- Click on create image
- Enter the name of the image & select the VM from which you would like to create this image.
- You can make this image available thru multiple regions or limit to a particular region
- It should also be noted that the VM should be stopped while creating the image as a best practice.
Once the Image is created, you will be able to use it when creating other Instances. You can go to boot disks, click on change & choose the new custom image.