Getting, Listing, and Deleting Instance Templates

This page describes how to get, list, and delete instance templates.

Getting information about an instance template

Console

  1. In the GCP Console, go to the Instance Templates page.

    Go to the Instance templates page

  2. Click the name of the instance template to see the details of the template.

gcloud

Using the gcloud command-line tool, run:

gcloud compute instance-templates describe [INSTANCE_TEMPLATE_NAME]

API

In the API, make a instanceTemplates().get request:

GET https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/instanceTemplates/[INSTANCE_TEMPLATE]

Listing instance templates

To get a list of instance templates you created:

Console

The Instance Templates page lists all of the instance templates in your project.

Go to the Instance Templates page

gcloud

Using the gcloud command-line tool, run:

gcloud compute instance-templates list

API

In the API, make a instanceTemplates().list request:

GET https://www.googleapis.com/compute/v1/projects/myproject/global/instanceTemplates

Deleting 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.

Console

  1. In the GCP Console, go to the Instance Templates page.

    Go to the Instance Templates page

  2. Select the instance templates you want to delete.
  3. Click Delete.

gcloud

Using the gcloud command-line tool, run:

gcloud compute instance-templates delete [INSTANCE_TEMPLATE_NAME]

API

In the API, make a instanceTemplates().delete request:

DELETE https://www.googleapis.com/compute/v1/projects/myproject/global/instanceTemplates/[INSTANCE_TEMPLATE_NAME]

Sometimes the instances 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 an instance in a managed instance group uses a different template than what is specified on the group, that instance will continue to use its template for autohealing events even if that template is deleted. To update an instance to the new template, recreate that instance.