Create an instance template for a MIG of GPU VMs

Create a global instance template that you can use to create a managed instance group (MIG) of GPU VMs.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

Terraform

To learn how to apply or remove a Terraform configuration, see Basic Terraform commands. For more information, see the Terraform provider reference documentation.

resource "google_compute_instance_template" "default" {  name = "gpu-template"  machine_type = "n1-standard-2"  disk {  source_image = "debian-cloud/debian-11"  }  network_interface {  network = "default"  }  guest_accelerator {  type = "nvidia-tesla-t4"  count = 1  }  scheduling {  on_host_maintenance = "TERMINATE"  } }

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.