Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Concerning instances created from instance-derived instance template

Hello everyone. Please I am relatively new to google cloud and still putting through its paces. I recently learnt how to create an instance template from a pre-existing vm instance. I want to know if the subsequent vm instances created from the template will have installed on them, software that was installed on the original instance that was used to create the instance template. For instance if I have jdk/jre installed on the original instance, will the subsequent instances have them installed? If not is there a way a way to achieve this effect? Thank you

Solved Solved
0 4 520
1 ACCEPTED SOLUTION

Howdy Imonike,

It is my understanding that you have likely created an instance template from a pre-existing VM.  This means that NEW VMs you create from the template will have the same machine specifications but will NOT be clones of the original VM's hard-disks which may have been customized with settings and applications.  Think about both you and I ordering a new home PC from Dell.  We may both purchase model "XYZ" and when we both receive the machines, they will be of the same specification.  This is like saying we both get new machines from the "template XYZ".  However, that is as far as it goes.  The original template will identify a "boot disk" that will be the basic disk from the manufacturer.     To create new Compute Engine machines that already contain changed configurations, you will want to create a custom boot image.  See the following for instructions:

https://cloud.google.com/compute/docs/images/create-custom

Once you have created a custom boot image, you can then create a template that references the custom image ... see:

https://cloud.google.com/compute/docs/instance-templates/create-instance-templates#based-on-existing...

When you do that, THEN when you create a new VM instance form your template, that will ALSO use the custom boot image as the base image from which the new machine will use.

However ... while I think I am directly answering your question ... let me make an alternative suggestion.  Instead of trying to create new Custom Images, consider walking into the world of Docker and creating a "Docker Image".  If you create a Docker image that can then be instantiated not only on vanilla GCP VMs but also in Kubernetes, on-premises and on other cloud providers.   Now, you may have solid reasons for going down the custom image path ... but I haven't heard it yet ... and would advise examining Docker images/containers to see if that won't be a better path.

View solution in original post