Create a Cloud TPU VM instance using Compute Engine

This document shows you how to create a single TPU VM with the Compute Engine gcloud compute instances create command. You can also create a TPU VM instance by specifying an instance template. For more information, see Create a VM from an instance template.

Prerequisites

Complete the following prerequisites:

  1. Create a Google Cloud project for your TPUs as described in Set up a Google Cloud project for TPUs.

  2. Determine your TPU requirements as described in Plan your Cloud TPU resources.

Create a TPU VM instance

The parameters you use to create a TPU VM instance depend on the consumption option you are using: on-demand, Spot, reservation-bound, or flex-start. For more information, see Plan your TPU resources .

Create an on-demand TPU VM instance

To create an on-demand TPU VM instance, use the gcloud compute instances create command:

gcloud

gcloud compute instances create TPU_NAME \
  --machine-type=MACHINE_TYPE \
  --image-family=IMAGE_FAMILY \
  --image-project=IMAGE_PROJECT \
  --zone=ZONE \
  --maintenance-policy=TERMINATE

REST

curl -X POST \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "TPU_NAME",
    "machineType": "zones/