Stay organized with collections Save and categorize content based on your preferences.
This page describes how to get, list, and delete instance templates.
Before you beginSelect the tab for how you plan to use the samples on this page:
ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloudInstall the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.To use the Go samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
JavaTo use the Java samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
Node.jsTo use the Node.js samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
PythonTo use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
RESTTo use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
When you view an existing instance template, you can see its name, unique ID, creation timestamp, and all the instance properties that it specifies.
ConsoleTo get information about a regional or a global instance template, use the instance-templates describe command
.
For a regional instance template, use the following command:
gcloud compute instance-templates describe INSTANCE_TEMPLATE_NAME_OR_ID \ --region=REGION
For a global instance template, use the following command:
gcloud compute instance-templates describe INSTANCE_TEMPLATE_NAME_OR_IDGo Java Node.js Python REST
To get information about a regional instance template, use the regionInstanceTemplates.get
method as follows:
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceTemplates/INSTANCE_TEMPLATE_NAME_OR_ID
To get information about a global instance template, use the instanceTemplates.get
method as follows:
GET https://compute.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/instanceTemplates/[INSTANCE_TEMPLATE_NAME_OR_ID]List instance templates
To get a list of instance templates you created:
ConsoleThe Instance Templates page lists all of the instance templates in your project.
Go to the Instance Templates page
gcloudTo get a list of all regional instance templates, use the following command:
gcloud compute instance-templates list \ --regions
To get a list of regional instance templates in a specific region, use the following command:
gcloud compute instance-templates list \ --filter="region:(REGION)"
To get a list of global instance templates, use the following command:
gcloud compute instance-templates list \ --global
To get a list of all instance templates, including the regional and global, use the following command:
gcloud compute instance-templates listGo Java Node.js Python REST
To get a list of regional instance templates, make a regionInstanceTemplates.list
request:
GET https://compute.googleapis.com/compute/v1/projects/PROJECT/regions/REGION/instanceTemplates
To get a list of global instance templates, make a instanceTemplates.list
request:
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/instanceTemplatesDelete an instance template
Deleting an instance template removes it from your list of templates. You cannot delete an instance template if a managed instance group references it.
ConsoleUsing the Google Cloud CLI, run:
gcloud compute instance-templates delete INSTANCE_TEMPLATE_NAME
For a regional instance template, INSTANCE_TEMPLATE_NAME must contain the full URL of the template. For example, https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/instanceTemplates/example-regional-instance-template
.
To delete a regional instance template, make a regionInstanceTemplates.delete
request:
DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceTemplates/INSTANCE_TEMPLATE_NAME
To delete a global instance template, make a instanceTemplates.delete
request:
DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/instanceTemplates/INSTANCE_TEMPLATE_NAME
Sometimes the VMs in a managed instance group can be out of sync with the rest of the group, and use a different instance template than the rest of the group. If a VM in a managed instance group uses a different template than what is specified on the group, that VM will continue to use its template for repair even if that template is deleted. For more information about applying a new instance template, see Applying new configurations to VMs in a MIG.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This page provides instructions on how to manage instance templates, including retrieving information about them, listing them, and deleting them."],["Authentication is required to interact with Google Cloud services and APIs, and the gcloud CLI, console, or other supported languages can be used for this purpose."],["You can get details about both global and regional instance templates using the console, gcloud command-line tool, or language-specific code samples."],["Instance templates can be listed globally or by region via the console, gcloud CLI commands, or code samples."],["Instance templates can be deleted through the console, gcloud CLI commands, or programmatically, but if a managed instance group is referencing the template, deletion is not allowed."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4