This document explains how to create a managed instance group (MIG) to add GPU virtual machine (VM) instances all at once.
The MIG uses the bulk mode of its target size policy to add the VMs all at once. It also uses the flex-start provisioning model to improve obtainability of resources. For more information about the flex-start provisioning model, see About provisioning models .
Another method to add GPU VMs all at once in a MIG is by creating resize requests. To determine whether bulk mode or resize request is more suitable for your workload, see the Comparison of bulk mode and resize request .
If your workload doesn't require the MIG to creates VMs all at once but you still want to improve resource obtainability, use the flex-start provisioning model as described in Create a MIG with Flex-start VMs .
Before you begin
- To make sure that you have sufficient GPU quota for the resources you're requesting, check your GPU quota .
- To understand quota consumption, read GPU VMs and preemptible allocation quotas .
- If you haven't already, set up authentication
.
Authentication verifies your identity for access to Google Cloud services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Install 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 .
- Set a default region and zone .
REST
To 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.
-
Limitations
The following limitations apply:
Create a MIG and add GPU VMs all at once
To create the GPU VMs all at once, do the following:
-
Create an instance template , which is required to create a MIG. The MIG then uses this template to create each VM in the group. In the template, specify the configurations for the flex-start provisioning model.
For more information about instance templates, see About instance templates .
-
Create a MIG for bulk provisioning of VMs . During the MIG creation, enable the bulk provisioning capability in the MIG by setting the target size policy mode to
BULK. InBULKmode, the MIG attempts to create all VMs at once to meet the target size that you set.
Create an instance template
Create an instance template that specifies a GPU machine series . Then, use the template to create a MIG .
Note: If you want to run data science or machine learning workloads, consider using a Deep Learning VM image when you create an instance template. Deep Learning VM Images is a set of prepackaged VM images that comes with machine learning frameworks and essential tools. For more information about these images, see Choose an image in the Deep Learning VM Images documentation.
Permissions required for this task
To perform this task, you must have the following permissions :
- All permissions required to call the
instanceTemplates.insertmethod .

