Instance templates Stay organized with collections Save and categorize content based on your preferences.
This document describes what an instance template is, when to use an instancetemplate, and what a deterministic instance template is. It also provides acomparison between regional and global instance templates.
An instance template is a convenient way to save a virtual machine (VM)instance's configuration that includes machine type, boot disk image, labels,startup script, and other VM properties.
You can use an instance template to do the following:
Createindividual VMs.
Create VMs in amanaged instance group (MIG).
Createreservations for VMs.
To learn how to create an instance template, seeCreate instance templates.
When to use instance templates
Use instance templates any time you want to quickly create VMs or reservationsfor VMs based off of a pre-existing VM property. If you want to create a groupof identical VMs (a MIG), then you must create the MIG using an instancetemplate.
How to update instance templates
Instance templates are designed to create VMs with identical configurations. Youcan't update instance templates after they're created. Instead, do one of thefollowing:
Create a new instance template as follows:
Create VMs while overriding the instance template's properties.
Use deterministic instance templates to ensure identical VMs
Deterministic instance templates make explicitly clear the type of third-partyservices or apps to install on your VMs. This helps to ensure that your instancetemplate always creates VMs with an identical configuration. For example, if yourtemplate has a startup script that fetches an app, you can specify the versionof the app that you want in your template's startup script.
For more information, seeDeterministic instance templates.
Regional and global instance templates
Instance templates are available both asregionalandglobal resources.Unless you need to reuse an instance template across multiple regions, Googlerecommends using regional instance templates over global instance templates.
The following table provides a comparison between regional and global instancetemplates:
| Regional instance template | Global instance template | |
|---|---|---|
| Scope | You can use the template only in the template's region. | You can use the template in any region. |
| Reliability | Hardware errors are isolated to the template's region. | Hardware errors can impact any region where the template is used. |
| Use case |
| Reuse your global instance template to create VMs, MIGs, and reservations across multiple regions. |
Use of zonal or regional resources in instance templates
In an instance template, you might specify zonal resources, which restricts theuse of that template to the zone where that resource resides. Similarly, if youspecify a regional resource in a global instance template, the template isrestricted to that region. For example, if you include a read-only Persistent Diskfromus-central1-a in your instance template, you can't use that template inany other zone because that specific Persistent Disk exists only in zoneus-central1-a.
For more information about zonal resources, seeRegions and zones.
How to specify instance templates
When creating resources that are based on an instance template, depending on theinterface that you're using, you might need to specify the full orpartial URL of the instance template—for example:
- Full URL:
https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/instanceTemplates/1234567890 - Partial URL:
projects/example-project/regions/us-central1/instanceTemplates/1234567890
You can specify either the ID or the name of the instance template. Googlerecommends that you specify the ID because, unlike names, instance template IDscan't be reused. This approach helps to ensure that the resources that youcreate from the template have the properties that you intend.
To view the template ID of an instance, seeGet information about an instance template.
Pricing
There is no additional charge for using instance templates. You are chargedfor the resources that you create based on the templates.
ForCompute Engine pricing information, seePricing.What's next
Create an instance templatefrom scratch, based on an existing instance, or based on an existing instancetemplate.
Use an instance template tocreate a VM.
Use an instance template tocreate a MIGorupdate an existing MIG.
Use an instance template tocreate a reservation for VMs.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.