[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eInstance templates are used to save VM configurations, including machine type, boot disk image, labels, and startup scripts, for quick VM creation or reservations.\u003c/p\u003e\n"],["\u003cp\u003eInstance templates are utilized for creating individual VMs, managed instance groups (MIGs), and reservations for VMs, while MIGs must be created using an instance template.\u003c/p\u003e\n"],["\u003cp\u003eInstance templates cannot be updated after creation; instead, you can create new templates based on existing VMs or templates, or override properties when creating new VMs.\u003c/p\u003e\n"],["\u003cp\u003eDeterministic instance templates ensure VMs are created with identical configurations, specifically when third-party apps or services are involved, by specifying exact versions.\u003c/p\u003e\n"],["\u003cp\u003eRegional instance templates are recommended over global templates unless cross-region use is necessary, offering better reliability by isolating hardware errors and allowing for regional data residency, while both can be limited by the presence of zonal resources.\u003c/p\u003e\n"]]],[],null,["*** ** * ** ***\n\nThis document describes what an instance template is, when to use an instance\ntemplate, and what a deterministic instance template is. It also provides a\ncomparison between regional and global instance templates.\n\nAn instance template is a convenient way to save a virtual machine (VM)\ninstance's configuration that includes machine type, boot disk image, labels,\nstartup script, and other VM properties.\n\nYou can use an instance template to do the following:\n\n- Create\n [individual VMs](/compute/docs/instances/create-vm-from-instance-template).\n\n- Create VMs in a\n [managed instance group (MIG)](/compute/docs/instance-groups/creating-groups-of-managed-instances).\n\n- Create\n [reservations for VMs](/compute/docs/instances/choose-reservation-type).\n\nTo learn how to create an instance template, see\n[Create instance templates](/compute/docs/instance-templates/create-instance-templates).\n\nWhen to use instance templates\n\nUse instance templates any time you want to quickly create VMs or reservations\nfor VMs based off of a pre-existing VM property. If you want to create a group\nof identical VMs (a MIG), then you must create the MIG using an instance\ntemplate.\n\nHow to update instance templates\n\nInstance templates are designed to create VMs with identical configurations. You\ncan't update instance templates after they're created. Instead, do one of the\nfollowing:\n\n- Create a new instance template as follows:\n\n - [Create an instance template based on an existing VM](/compute/docs/instance-templates/create-instance-templates#based-on-existing-instance).\n\n - [Create an instance template based on an existing template](/compute/docs/instance-templates/create-instance-templates#based-on-existing-template).\n\n- [Create VMs while overriding the instance template's properties](/compute/docs/instances/create-vm-from-instance-template#creating_a_vm_instance_from_an_instance_template_with_overrides).\n\nUse deterministic instance templates to ensure identical VMs\n\nDeterministic instance templates make explicitly clear the type of third-party\nservices or apps to install on your VMs. This helps to ensure that your instance\ntemplate always creates VMs with an identical configuration. For example, if your\ntemplate has a startup script that fetches an app, you can specify the version\nof the app that you want in your template's startup script.\n\nFor more information, see\n[Deterministic instance templates](/compute/docs/instance-templates/deterministic-instance-templates).\n\nRegional and global instance templates\n\nInstance templates are available both as\n[regional](/compute/docs/regions-zones/global-regional-zonal-resources#regionalresources)\nand\n[global resources](/compute/docs/regions-zones/global-regional-zonal-resources#globalresources).\nUnless you need to reuse an instance template across multiple regions, Google\nrecommends using regional instance templates over global instance templates.\n\nThe following table provides a comparison between regional and global instance\ntemplates:\n\n| | Regional instance template | Global instance template |\n|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|\n| **Scope** | You can use the template only in the template's region. | You can use the template in any region. |\n| **Reliability** | Hardware errors are isolated to the template's region. | Hardware errors can impact any region where the template is used. |\n| **Use case** | - Reduce cross-region dependency. - Achieve data residency in a region. For example, to meet compliance requirements on the physical location of the data. | Reuse your global instance template to create VMs, MIGs, and reservations across multiple regions. |\n\nUse of zonal or regional resources in instance templates\n\nIn an instance template, you might specify zonal resources, which restricts the\nuse of that template to the zone where that resource resides. Similarly, if you\nspecify a regional resource in a global instance template, the template is\nrestricted to that region. For example, if you include a read-only Persistent Disk\nfrom `us-central1-a` in your instance template, you can't use that template in\nany other zone because that specific Persistent Disk exists only in zone\n`us-central1-a`.\n\nFor more information about zonal resources, see\n[Regions and zones](/compute/docs/regions-zones#available).\n\nHow to specify instance templates\n\nWhen creating resources that are based on an instance template, depending on the\ninterface that you're using, you might need to specify the full or\npartial URL of the instance template---for example:\n\n- Full URL: `https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/instanceTemplates/1234567890`\n- Partial URL: `projects/example-project/regions/us-central1/instanceTemplates/1234567890`\n\nYou can specify either the ID or the name of the instance template. Google\nrecommends that you specify the ID because, unlike names, instance template IDs\ncan't be reused. This approach helps to ensure that the resources that you\ncreate from the template have the properties that you intend.\n\nTo view the template ID of an instance, see\n[Get information about an instance template](/docs/instance-templates/get-list-delete-instance-templates#get_information_about_an_instance_template).\n\nPricing\n\nThere is no additional charge for using instance templates. You are charged\nfor the resources that you create based on the templates.\nFor Compute Engine pricing information, see [Pricing](https://cloud.google.com/compute/all-pricing).\n\nWhat's next\n\n- [Create an instance template](/compute/docs/instance-templates/create-instance-templates)\n from scratch, based on an existing instance, or based on an existing instance\n template.\n\n- Use an instance template to\n [create a VM](/compute/docs/instances/create-vm-from-instance-template).\n\n- Use an instance template to\n [create a MIG](/compute/docs/instance-groups/creating-groups-of-managed-instances)\n or [update an existing MIG](/compute/docs/instance-groups/updating-migs).\n\n- Use an instance template to\n [create a reservation for VMs](/compute/docs/instances/choose-reservation-type)."]]