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:
-
Create a Google Cloud project for your TPUs as described in Set up a Google Cloud project for TPUs .
-
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
compute
instances
create
TPU_NAME
\
--machine-type =
MACHINE_TYPE
\
--image-family =
IMAGE_FAMILY
\
--image-project =
IMAGE_PROJECT
\
--zone =
ZONE
\
--maintenance-policy =
TERMINATE
Replace the following placeholders:
- TPU_NAME : A name for your TPU VM.
- MACHINE_TYPE
: The machine type
for the TPU VM (for example
ct6e-standard-8t). - IMAGE_FAMILY
: The OS image family
for the TPU VM. If you want to install a specific OS version, use the
--imageflag. For more information about OS images, see OS images . - IMAGE_PROJECT
: The project that contains the OS image.
For TPU images, this is
ubuntu-os-accelerator-images. - ZONE
: The zone
for the TPU VM (for example
us-central1-b).
Create a TPU Spot VM instance
To create a TPU Spot VM instance, use the gcloud compute instances create
command
with the --provisioning-model=SPOT
flag:
gcloud
compute
instances
create
TPU_NAME
\
--machine-type =
MACHINE_TYPE
\
--image-family =
IMAGE_FAMILY
\
--image-project =
IMAGE_PROJECT
\
--zone =
ZONE
\
--provisioning-model =
SPOT
\
--instance-termination-action =
DELETE
\
--maintenance-policy =
TERMINATE
Replace the following placeholders:
- TPU_NAME : A name for your TPU VM.
- MACHINE_TYPE
: The machine type
for the TPU VM (for example
ct6e-standard-8t). - IMAGE_FAMILY
: The OS image family
for the TPU VM. If you want to install a specific OS version, use the
--imageflag. For more information about OS images, see OS images . - IMAGE_PROJECT
: The project that contains the OS image.
For TPU images, this is
ubuntu-os-accelerator-images. - ZONE
: The zone
for the TPU VM (for example
us-central1-b).
Create a TPU VM instance using a reservation
To create a TPU VM instance using the reservation-bound
consumption option,
use the gcloud compute instances create
command
with the --reservation-affinity=specific
and --reservation
flags:
gcloud
compute
instances
create
TPU_NAME
\
--machine-type =
MACHINE_TYPE
\
--image-family =
IMAGE_FAMILY
\
--image-project =
IMAGE_PROJECT
\
--zone =
ZONE
\
--provisioning-model =
reservation-bound
\
--reservation-affinity =
specific
\
--reservation =
RESERVATION_NAME
\
--instance-termination-action =
DELETE
\
--maintenance-policy =
TERMINATE
Replace the following placeholders:
- TPU_NAME : A name for your TPU VM.
- MACHINE_TYPE
: The machine type
for the TPU VM (for example
ct6e-standard-8t). - IMAGE_FAMILY
: The OS image family
for the TPU VM. If you want to install a specific OS version, use the
--imageflag. For more information about OS images, see OS images . - IMAGE_PROJECT
: The project that contains the OS image.
For TPU images, this is
ubuntu-os-accelerator-images. - ZONE
: The zone
for the TPU VM (for example
us-central1-b). - RESERVATION_NAME : The name of your reservation.
Create a TPU Flex-start VM
To create a TPU Flex-start
VM instance, use the gcloud compute instances create
command
with the --provisioning-model=FLEX_START
flag:
gcloud
compute
instances
create
TPU_NAME
\
--machine-type =
MACHINE_TYPE
\
--image-family =
IMAGE_FAMILY
\
--image-project =
IMAGE_PROJECT
\
--zone =
ZONE
\
--provisioning-model =
FLEX_START
\
--max-run-duration =
MAX_RUN_DURATION
\
--request-valid-for-duration =
VALID_DURATION
\
--instance-termination-action =
DELETE
\
--maintenance-policy =
TERMINATE
Replace the following placeholders:
- TPU_NAME : A name for your TPU VM.
- MACHINE_TYPE
: The machine type
for the TPU VM (for example
ct6e-standard-8t). - IMAGE_FAMILY
: The OS image family
for the TPU VM. If you want to install a specific OS version, use the
--imageflag. For more information about OS images, see OS images . - IMAGE_PROJECT
: The project that contains the OS image.
For TPU images, this is
ubuntu-os-accelerator-images. - ZONE
: The zone
for the TPU VM (for example
us-central1-b). - MAX_RUN_DURATION
: The maximum run duration for the TPU VM (for example
6h). - VALID_DURATION : The maximum duration for which the request is valid.
For more information about creating Compute Engine instances, see Create and start a Compute Engine instance .
What's next
- Learn how to Create a MIG with single-host Cloud TPU slices .
- Learn how to Create a MIG with a multi-host Cloud TPU slice .
- Learn how to manage TPU VMs .
- Learn about TPUs in GKE .
- Learn how to run an ML workload on TPUs, for example, Serve Qwen2-72B-Instruct with vLLM on TPUs .

