This document explains how to create a custom cluster in Cluster Director. You customize the compute, networking, and storage resources for your artificial intelligence (AI), machine learning (ML), or high performance computing (HPC) workloads.
This process lets you design a fault-tolerant and highly scalable Slurm environment with your own custom specifications, helping your cluster meet the needs of your workloads. To create a cluster based on a template that is optimized for running AI and ML workloads, instead see Create an AI-optimized cluster based on a template.
Limitations
When you create a cluster in Cluster Director, the following limitations apply:
- Zonal scope: all cluster resources must exist within the same zone. You can
only create or use compute resources, storage resources, and subnetworks that exist within the
same zone as your cluster. Cluster Director doesn't support AI zones, which are zones with
names that contain
-aiafter the region name (for example,us-central1-ai1a). - Compute resource configuration per nodeset: you can specify only one compute resource configuration for each nodeset in your cluster. Additionally, a cluster partition that contains a TPU nodeset can't contain GPU or CPU nodesets, and can't combine static and dynamic TPU nodesets.
- Storage classes for new Cloud Storage buckets: if you plan to add new Cloud Storage buckets to your cluster, then you can specify only the Rapid storage class, Standard storage class, or Autoclass. If you want to use other storage classes, then you must update your buckets after you create them. For instructions, see Change object storage classes.
- Slurm controller version: clusters must meet the following Slurm version
requirements:
- You can specify the Slurm controller version only when you create a cluster by using the Google Cloud CLI or the REST API; you can't modify the controller version for an existing cluster.
- Compute nodes can't run a newer Slurm version than the controller node. For example, if the controller node in your cluster uses Slurm 25.05, then your compute nodes can't use an OS image that requires Slurm 26.05. To check the Slurm version of an OS image, see Supported OS images.
- Hyperdisk pools: if you plan to use storage pools for node boot disks, then you can use only existing storage pools or Hyperdisk Exapools that use Hyperdisk Balanced volumes. Storage pools must reside in the same project and zone as the nodes that use them.
Before you begin
Before you create a cluster in Cluster Director, do the following:
Choose consumption options. If you haven't already, then you must choose the consumption options for the VMs that you want to use in each partition for your cluster. Each consumption option determines the availability, obtainability, and pricing for your VMs.
To learn more, see Choose a consumption option.
Obtain capacity and quota. Based on your chosen consumption option, review the quota requirements for the VMs that you want to create in the cluster. If you lack sufficient quota, then creating your cluster fails.
To learn more, see Capacity and quota overview.
Verify usable reservations. If you want to create your cluster by using one or more reservations, then verify that the reservations have enough available resources to create your chosen number of VMs in the cluster. Otherwise, skip this step.
To learn more, see Consumable VMs in a reservation.
Verify trusted image policy. If the organization in which your project exists has a trusted image policy (
constraints/compute.trustedImageProjects), then verify that theclusterdirector-public-imagesproject is included in the list of allowed projects.To learn more, see Setting up trusted image policies.
Verify existing resource requirements. If you plan to use existing storage or networking resources in your cluster instead of creating new ones, then you must verify that those resources are correctly configured. Otherwise, skip this step.
To learn more, see Cluster creation process overview.
Authenticate. To use the samples on this page, you might need to authenticate to Google.
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
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
Terraform
To use the Terraform samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
-
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.
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
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.
-
Required roles
To get the permissions that you need to create a custom cluster, ask your administrator to grant you the following IAM roles:
-
To create and manage a cluster:
Cluster Director Editor (
roles/hypercomputecluster.editor) on your project -
To manage resources in a cluster:
Compute Instance Admin (v1) (
roles/compute.instanceAdmin.v1) on your project -
To connect to the login node in a cluster:
- Compute OS Login (
roles/compute.osLogin) on your project - IAP-Secured Tunnel User (
roles/iap.tunnelResourceAccessor) on your project - Service Account User (
roles/iam.serviceAccountUser) on the Compute Engine default service account
- Compute OS Login (
These predefined roles contain the permissions required to create a custom cluster. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to create a custom cluster:
-
To create a cluster:
hypercomputecluster.clusters.create -
To check the status of the cluster creation operation:
hypercomputecluster.operations.get -
To view the details of a cluster:
hypercomputecluster.clusters.get -
To connect to the login node in a cluster:
-
compute.instances.osLogin -
iap.tunnelInstances.accessViaIAP -
iam.serviceAccounts.actAs
-
To ensure that the Compute Engine default service account has the necessary permissions to create a custom cluster, ask your administrator to grant the following IAM roles to the Compute Engine default service account on your project:
- Logs Writer (
roles/logging.logWriter) - Monitoring Metric Writer (
roles/monitoring.metricWriter) - Storage Object Viewer (
roles/storage.objectViewer)
For more information about granting roles, see Manage access to projects, folders, and organizations.
Your administrator might also be able to give the Compute Engine default service account the required permissions through custom roles or other predefined roles.
Create a custom cluster
To create a custom cluster, select one of the following options. If you want to create a cluster with TPU VMs, then use the Google Cloud console or gcloud CLI. If you want to configure the Slurm controller version for the controller node, then use the gcloud CLI or REST API. If you want to configure custom Slurm settings, then use the REST API.
Console
In the Google Cloud console, go to the Cluster Director page.
Click Create cluster.
In the dialog that appears, click Step-by-step configuration. The Create cluster page opens.
In the Cluster name field, enter a name for your cluster. The name can contain up to 10 characters, and it can only use numbers or lowercase letters (
a-z). Spaces or special characters aren't allowed.In the Compute section, click Configure resources. The Add resource configuration pane appears.
To configure a compute resource configuration, complete the following steps:
In the Machine configuration section, select the machine series and type that you want to use.
In the Consumption options section, specify the consumption option that you want to use to obtain resources:
To create GPU or TPU instances by using a reservation, do the following:
Click the Use reservation tab.
Click Select reservation. The Choose a reservation pane appears. If you want to use a reservation of A4X, TPU7x, or TPU v6e VMs, then you can choose the block or sub-block to control the placement of your VMs. For TPU VMs, the reservation must use the all-capacity mode.
Select the reservation that you want to use. Then, click Choose. This action sets the Region and Zone fields to the region and zone of your reservation.
To create GPU or TPU Flex-start VMs, do the following:
Click the Flex start tab.
In the Time limit for the VM section, specify the run duration for the Flex-start VMs. The value must be between 10 minutes and 7 days.
In the Location section, select the region where you want to create Flex-start VMs. The Google Cloud console filters the available regions to show those regions that support Flex-start VMs for your selected machine type.
To create GPU, TPU, or N2 Spot VMs, do the following:
Click the Use spot tab.
In the On VM termination list, select one of the following options:
To delete Spot VMs on preemption, select Delete. TPU Spot VMs support only Delete.
To stop GPU or N2 Spot VMs on preemption, select Stop.
In the Location section, select the Region and Zone where you want to create Spot VMs. The Google Cloud console filters the available regions to show those regions that support Spot VMs for your selected machine type.
To create TPU or N2 on-demand instances, do the following:
Click the Use on-demand tab.
In the Location section, select the region where you want to create instances.
Click Done.
Optional: To create additional compute resource configurations, click Add resource configuration, and then follow the prompts to specify the compute resources.
Click Continue.
In the Choose a Virtual Private Cloud (VPC) network section, do one of the following:
Recommended: To let Cluster Director automatically create a pre-configured VPC network for your cluster, do the following:
Select Create a new VPC network.
In the Network name field, enter a name for the VPC network.
To use an existing VPC or Shared VPC network, do the following:
Select Use a VPC network in the current project or Use a Shared VPC network hosted in another project.
In the Select VPC network or Shared VPC network list, select a VPC or Shared VPC network that meets the required configurations.
In the Select subnetwork list, select an existing subnetwork.
Click Continue.
Optional: In the Storage section, to edit a storage resource, click Edit storage plan, and then do one of the following:
To specify a Filestore instance, do the following:
Click the Filestore tab.
In the Instance provisioning section, select one of the following options:
To use an existing Filestore instance that uses the same network as your cluster, select Select existing Filestore instance, and then select the instance.
To create a new Filestore instance, select Create new instance. Then, follow the prompts to create your instance. For more information about the configurations that you can specify in the instance, see Create an instance.
To specify a Google Cloud Managed Lustre instance, do the following:
Click the Managed Lustre tab.
In the Instance provisioning section, select one of the following options:
To use an existing Managed Lustre instance, select Select an existing Managed Lustre instance, and then select the instance.
To create a new Managed Lustre instance, select Create new instance. Then, follow the prompts to create your instance. For more information about the configurations that you can specify in the instance, see Create a Managed Lustre instance.
To specify a Cloud Storage bucket, do the following:
Click the Cloud Storage tab.
In the Bucket provisioning section, select one of the following options:
To use an existing Cloud Storage bucket, select Select an existing bucket, and then select the bucket.
To create a new Cloud Storage bucket, select Create a new bucket, and then follow the prompts to create your bucket. For more information about the configurations that you can specify in the bucket, see Create a bucket.
Optional: To add storage resources to your cluster, click Add storage configuration, and then follow the prompts to specify the configuration for the storage resource.
Click Continue.
Optional: To configure the login node, expand the Login node section, and then complete the following steps:
In the Node count field, enter the number of login nodes that you want to create in your cluster.
In the Machine type field, specify a machine type for the login node. If you use A4X Max or A4X instances in your cluster, then specify a C4A or N2 machine type. Otherwise, specify an N2 machine type.
Optional: To replace the default OS image for the login nodes, do the following:
In the Image family list, select an OS image family. For more information about supported images, see Supported OS images for Cluster Director.
In the Image list, select a specific OS image version. By default, the Image list selects the latest OS image version for the machine series specified in the login nodes.
Optional: To add a startup script, click Add startup script. Then, in the Add startup script pane that appears, enter your script. For more information about using startup scripts, see About startup scripts.
In the Boot disk type and Boot disk size fields, select a boot disk type and size for the compute instances in the login node. For more information about the boot disks that your compute instances can use, see Choose a disk type.
Optional: To specify more advanced configurations for the login node, expand Advanced login node settings. Then, follow the prompts to manage OS login, manage public IPs, or add or remove labels to the compute instances in the login node.
Optional: To manage the partitions in your cluster to organize your compute resources, expand the Partitions section, and then do one of the following:
To edit a partition, expand the row that contains the partition, and then do the following:
In the Partition name field, enter a name for the partition.
To edit a nodeset, click Edit NODESET_NAME. To add a nodeset, click Add nodeset. A pane to edit or create a nodeset appears.
In the Nodeset name field, enter a name for your nodeset.
In the Resource configuration field, select a compute resource configuration that you created in the previous steps.
In the Image family list, select an OS image family to use for the compute nodes in the nodeset.
Optional: In the Image list, select a specific OS image version. By default, the Image list selects the latest OS image version for the machine series specified in the nodeset.
In the Boot disk type and Boot disk size fields, select a boot disk type and size for the compute nodes in the nodeset.
Optional: To share disk capacity and performance across nodes in a nodeset, specify an existing Hyperdisk pool or Hyperdisk Exapool as follows:
Select the Enable storage pool checkbox.
In the Select a storage pool list, select a storage pool that uses Hyperdisk Balanced volumes.
Configure the node counts for the nodeset:
For GPU or CPU nodesets, in the Static node count field, enter the minimum number of compute nodes that must run at all times. In the Dynamic node count field, enter the maximum number of additional compute nodes that Cluster Director can create when demand increases.
For TPU nodesets, in the Node lifecycle section, select one of the following options:
To provision TPU slices per job, select Use dynamic scaling, and then in the Max number of dynamic nodes field, enter the maximum number of dynamic TPU nodes.
To keep persistent TPU slices active between jobs, select Use static nodes. Then, in the TPU topology section that appears, select a slice topology and the number of slices.
Optional: To specify more advanced configurations for the compute node, expand Advanced nodeset settings. Then, follow the prompts to add or remove startup scripts, or add or remove labels.
Optional: To add a nodeset to the partition, click Add nodeset. Then, follow the prompts to configure the nodeset.
Click Done.
To add a partition, click Add partition, and then follow the prompts to specify the compute resources for the partition.
To remove a partition, click Delete partition.
Optional: To add prolog or epilog scripts to your Slurm cluster, do the following:
Expand the Advanced orchestration settings section.
In the Scripts section, follow the prompts to add prolog or epilog scripts.
Click Create. The Clusters page appears.
Creating the cluster can take some time to complete. The completion time depends on the number of compute instances that you request and resource availability in the zone of the compute instances. If your requested resources are unavailable, then Cluster Director maintains the creation request until resources become available. When Cluster Director creates your login node, you can connect to your cluster; however, you can only run workloads when Cluster Director creates the compute nodes in your cluster.
gcloud
To create a custom cluster, use the
gcloud alpha cluster-director clusters create command.
Based on how you want to specify the cluster configuration, use one of the following methods:
Specify a configuration file: to create a cluster by specifying the cluster configuration in a JSON file, use the
--configflag. To create the cluster, select one of the following options:Bash
gcloud alpha cluster-director clusters create CLUSTER_NAME \ --location=REGION \ --config=CONFIGURATION_FILEPowershell
gcloud alpha cluster-director clusters create CLUSTER_NAME ` --location=REGION ` --config=CONFIGURATION_FILEcmd.exe
gcloud alpha cluster-director clusters create CLUSTER_NAME ^ --location=REGION ^ --config=CONFIGURATION_FILEReplace the following:
CLUSTER_NAME: the name of the cluster. The name can contain up to 10 characters, and it can only use numbers or lowercase letters.REGION: the region where you want to create your cluster.CONFIGURATION_FILE: the path to the JSON file that contains the configuration details for the cluster. To review the configuration details that you can specify, review the request body for creating a cluster by using REST.
Specify cluster properties directly: to create a cluster by specifying each configuration property directly, use the following flags:
To specify a network, use one of the following flags:
To create a new network:
--create-networkTo use an existing network and subnetwork:
--networkand--subnet
To specify a Filestore instance, use one of the following flags:
To create a new instance:
--create-filestoresTo use an existing instance:
--filestores
Optionally, to specify a Cloud Storage bucket, use one of the following flags:
To create a new bucket:
--create-bucketsTo use an existing bucket:
--buckets
Optionally, to specify a Google Cloud Managed Lustre instance, use one of the following flags:
To create a new instance:
--create-lustresTo use an existing instance:
--lustres
To specify a compute resource configuration, use one of the following flags for each resource configuration that you want to create in the cluster:
To create compute instances by using a reservation:
--reserved-instancesTo create Flex-start VMs:
--flex-start-instancesTo create Spot VMs:
--spot-instancesTo create TPU or N2 on-demand instances:
--on-demand-instances
To specify the configuration for the login node, use the
--slurm-login-nodeflag.To specify the configuration for a compute nodeset, use the
--slurm-node-setsflag. You can repeat this flag for each nodeset in the cluster.To specify the cluster partitions, use the
--slurm-partitionsflag. You can repeat this flag for each partition in the cluster.To specify the default partition for the cluster, use the
--slurm-default-partitionflag.Optionally, to specify the Slurm version for the controller node in your cluster, use the
--controller-versionflag.
For example, suppose that you want to create a cluster that has one partition with reserved compute instances, one partition with Spot VMs, a new Filestore instance, and a new network. To create the example cluster, select one of the following options:
Bash
gcloud alpha cluster-director clusters create CLUSTER_NAME \ --location=REGION \ --create-network=name=NETWORK_NAME \ --create-filestores=name="locations/FILESTORE_INSTANCE_ZONE/instances/FILESTORE_INSTANCE_NAME",tier=TIER,capacityGb=CAPACITY,fileshare=SHARE_NAME,protocol=PROTOCOL \ --reserved-instances=id=COMPUTE_RESOURCE_NAME_1,reservation="projects/RESERVATION_PROJECT_ID/zones/RESERVATION_ZONE/reservations/RESERVATION_NAME" \ --spot-instances=id=COMPUTE_RESOURCE_NAME_2,zone=SPOT_VMS_ZONE,machineType=SPOT_MACHINE_TYPE \ --slurm-login-node=machineType=LOGIN_NODE_MACHINE_TYPE,zone=LOGIN_NODE_ZONE,count=LOGIN_NODES_COUNT \ --slurm-node-sets=id=NODESET_NAME_1,computeId=COMPUTE_RESOURCE_NAME_1,staticNodeCount=NODESET_1_STATIC_COUNT,maxDynamicNodeCount=NODESET_1_MAX_DYNAMIC_COUNT \ --slurm-node-sets=id=NODESET_NAME_2,computeId=COMPUTE_RESOURCE_NAME_2,staticNodeCount=NODESET_2_STATIC_COUNT,maxDynamicNodeCount=NODESET_2_MAX_DYNAMIC_COUNT \ --slurm-partitions=id=PARTITION_NAME_1,nodeSetIds=[NODESET_NAME_1] \ --slurm-partitions=id=PARTITION_NAME_2,nodeSetIds=[NODESET_NAME_2] \ --slurm-default-partition=PARTITION_NAME_1Powershell
gcloud alpha cluster-director clusters create CLUSTER_NAME ` --location=REGION ` --create-network=name=NETWORK_NAME ` --create-filestores=name="locations/FILESTORE_INSTANCE_ZONE/instances/FILESTORE_INSTANCE_NAME",tier=TIER,capacityGb=CAPACITY,fileshare=SHARE_NAME,protocol=PROTOCOL ` --reserved-instances=id=COMPUTE_RESOURCE_NAME_1,reservation="projects/RESERVATION_PROJECT_ID/zones/RESERVATION_ZONE/reservations/RESERVATION_NAME" ` --spot-instances=id=COMPUTE_RESOURCE_NAME_2,zone=SPOT_VMS_ZONE,machineType=SPOT_MACHINE_TYPE ` --slurm-login-node=machineType=LOGIN_NODE_MACHINE_TYPE,zone=LOGIN_NODE_ZONE,count=LOGIN_NODES_COUNT ` --slurm-node-sets=id=NODESET_NAME_1,computeId=COMPUTE_RESOURCE_NAME_1,staticNodeCount=NODESET_1_STATIC_COUNT,maxDynamicNodeCount=NODESET_1_MAX_DYNAMIC_COUNT ` --slurm-node-sets=id=NODESET_NAME_2,computeId=COMPUTE_RESOURCE_NAME_2,staticNodeCount=NODESET_2_STATIC_COUNT,maxDynamicNodeCount=NODESET_2_MAX_DYNAMIC_COUNT ` --slurm-partitions=id=PARTITION_NAME_1,nodeSetIds=[NODESET_NAME_1] ` --slurm-partitions=id=PARTITION_NAME_2,nodeSetIds=[NODESET_NAME_2] ` --slurm-default-partition=PARTITION_NAME_1cmd.exe
gcloud alpha cluster-director clusters create CLUSTER_NAME ^ --location=REGION ^ --create-network=name=NETWORK_NAME ^ --create-filestores=name="locations/FILESTORE_INSTANCE_ZONE/instances/FILESTORE_INSTANCE_NAME",tier=TIER,capacityGb=CAPACITY,fileshare=SHARE_NAME,protocol=PROTOCOL ^ --reserved-instances=id=COMPUTE_RESOURCE_NAME_1,reservation="projects/RESERVATION_PROJECT_ID/zones/RESERVATION_ZONE/reservations/RESERVATION_NAME" ^ --spot-instances=id=COMPUTE_RESOURCE_NAME_2,zone=SPOT_VMS_ZONE,machineType=SPOT_MACHINE_TYPE ^ --slurm-login-node=machineType=LOGIN_NODE_MACHINE_TYPE,zone=LOGIN_NODE_ZONE,count=LOGIN_NODES_COUNT ^ --slurm-node-sets=id=NODESET_NAME_1,computeId=COMPUTE_RESOURCE_NAME_1,staticNodeCount=NODESET_1_STATIC_COUNT,maxDynamicNodeCount=NODESET_1_MAX_DYNAMIC_COUNT ^ --slurm-node-sets=id=NODESET_NAME_2,computeId=COMPUTE_RESOURCE_NAME_2,staticNodeCount=NODESET_2_STATIC_COUNT,maxDynamicNodeCount=NODESET_2_MAX_DYNAMIC_COUNT ^ --slurm-partitions=id=PARTITION_NAME_1,nodeSetIds=[NODESET_NAME_1] ^ --slurm-partitions=id=PARTITION_NAME_2,nodeSetIds=[NODESET_NAME_2] ^ --slurm-default-partition=PARTITION_NAME_1Replace the following:
CLUSTER_NAME: the name of the cluster. The name can contain up to 10 characters, and it can only use numbers or lowercase letters (a-z). Spaces or special characters aren't allowed.REGION: the region where you want to create your cluster.NETWORK_NAME: the name of the network that you want to create.FILESTORE_INSTANCE_ZONE: the zone where you want to create your Filestore instance.FILESTORE_INSTANCE_NAME: the name for your Filestore instance.TIER: the type of service tier that you want to use for the instance and that Cluster Director supports. Specify one of the following values:For the zonal tier:
ZONALFor the regional tier:
REGIONAL
CAPACITY: the size, in GiB, that you want to allocate for the instance. The value must be between 1,024 GiB (1024) and 102,400 GiB (102400), and it must be in 256 GiB (256) increments.SHARE_NAME: the name for the NFS file share that is served from the instance.PROTOCOL: the system protocol for the instance. Specify one of the following values:For NFSv3:
NFSV3For NFSv4.1:
NFSV41
COMPUTE_RESOURCE_NAME_1andCOMPUTE_RESOURCE_NAME_2: the name of the two compute resource configurations.RESERVATION_PROJECT_ID: the ID of the project where the reservation exists. If you want to use a reservation from a different project, then verify that your project is allowed to consume the reservation. For more information, see Allow and restrict projects from creating and modifying shared reservations.RESERVATION_ZONE: the zone where the reservation exists.RESERVATION_NAME: the name of the reservation that you want to use to create VMs. If you use a reservation of A4X VMs, or an all-capacity mode reservation of TPU7x or TPU v6e VMs, then you can control VM placement. You can specify a block or sub-block from the following:Block: replace the
reservationattribute with thereservationBlockattribute as follows:reservationBlock="projects/RESERVATION_PROJECT_ID/zones/RESERVATION_ZONE/reservations/RESERVATION_NAME/reservationBlocks/RESERVATION_BLOCK_NAME"Sub-block: replace the
reservationattribute with thereservationSubBlockattribute as follows:reservationSubBlock="projects/RESERVATION_PROJECT_ID/zones/RESERVATION_ZONE/reservations/RESERVATION_NAME/reservationBlocks/RESERVATION_BLOCK_NAME/reservationSubBlocks/RESERVATION_SUB_BLOCK_NAME"
SPOT_VMS_ZONE: the zone where you want to create your Spot VMs. To review the regions and zones where the machine type that you want to use is available, see Available regions and zones.SPOT_MACHINE_TYPE: the machine type to use for the Spot VMs. Specify one of the following machine types:For an A4 machine type:
a4-highgpu-8gFor an A3 Ultra machine type:
a3-ultragpu-8gFor an A3 Mega machine type:
a3-megagpu-8gFor a TPU7x machine type:
tpu7x-standard-4tFor a TPU v6e machine type:
ct6e-standard-4tFor a TPU v5p machine type:
ct5p-hightpu-4tFor an N2 machine type, see N2 machine series.
LOGIN_NODE_MACHINE_TYPE: the machine type that you want the compute instances in the login nodeset to use. If you use A4X Max or A4X instances in your cluster, then specify a C4A or N2 machine type. Otherwise, specify an N2 machine type.LOGIN_NODE_ZONE: the zone where you want to create the compute instances in the login nodeset.LOGIN_NODES_COUNT: the number of compute instances to use for the login nodeset.NODESET_NAME_1andNODESET_NAME_2: the name of the two nodesets.NODESET_1_STATIC_COUNTandNODESET_2_STATIC_COUNT: the minimum number of compute instances that must always be running in each nodeset. If you configure a static nodeset with TPU instances, then set themaxDynamicNodeCountattribute to0and include theresourcePolicyConfigattribute in the--slurm-node-setsflag as follows:resourcePolicyConfig="{acceleratorTopology=TOPOLOGY}"Replace
TOPOLOGYwith the 2D (AxB) or 3D (AxBxC) slice topology (for example,2x4or2x2x2). The value of thestaticNodeCountattribute must be a multiple of the number of TPU VMs in the slice topology.NODESET_1_MAX_DYNAMIC_COUNTandNODESET_2_MAX_DYNAMIC_COUNT: the maximum number of compute instances that Cluster Director can add to each nodeset during increases in traffic. If you configure a dynamic TPU nodeset, then set thestaticNodeCountattribute to0.PARTITION_NAME_1andPARTITION_NAME_2: the name of the partitions for your cluster.
The output is similar to the following:
Create request issued for: [cluster000]
Waiting for operation [projects/example-project/locations/us-central1/operations/operation-1759856594716-640948b2f058e-f403bef9-1a08178a] to complete...working...
Creating the cluster can take some time to complete. The completion time depends on the number of compute instances that you request and resource availability in the zone of the compute instances. If your requested resources are unavailable, then Cluster Director maintains the creation request until resources become available. When Cluster Director creates your login node, the output is similar to the following:
Created cluster [cluster000].
You can then connect to your cluster; however, you can only run workloads when Cluster Director creates the compute nodes in your cluster.
Terraform
To create a custom cluster, use the
google_hypercomputecluster_cluster resource.
For example, suppose that you want to create a cluster that has one partition with reserved compute instances, one partition with Spot VMs, a new Filestore instance, and a new network. To create the example cluster, use the following resource:
Creating the cluster can take some time to complete. The completion time depends on the number of compute instances that you request and resource availability in the zone of the compute instances. If your requested resources are unavailable, then Cluster Director maintains the creation request until resources become available. When Cluster Director creates your login node, you can connect to your cluster. However, you can run workloads only after Cluster Director creates the compute nodes in your cluster.
REST
To create a custom cluster, make a POST request to the
clusters.create method.
Your request must include the following HTTP method and request URL:
POST https://hypercomputecluster.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/clusters?clusterId=CLUSTER_NAME
In the request body, include the following fields:
description: Optional. A description for your cluster.labels: Optional. Key-value pairs of labels to help you organize and filter your clusters and their associated resources. For more information, see Organize resources using labels.networkResources: the network configuration for your cluster. You can either create a new network or use an existing one.storageResources: the storage resources for your cluster. You can either create Filestore instances, Managed Lustre instances, or Cloud Storage buckets, or use existing ones.computeResources: the compute resources for your cluster, including the machine types and provisioning models to use for the compute instances in the cluster.orchestrator: the settings for the Slurm workload scheduler for your cluster, as well as the configurations for the cluster, partitions, and nodesets.
For example, suppose that you want to create a cluster that has one
partition with reserved compute instances, one partition with
Spot VMs, a new Filestore instance, and a
new network. To create the example cluster, include the following in a JSON
file named request-body.json:
{
"name": "CLUSTER_NAME",
"networkResources": {
"NETWORK_NAME": {
"config": {
"newNetwork": {
"network": "projects/PROJECT_ID/global/networks/NETWORK_NAME"
}
}
}
},
"storageResources": {
"STORAGE_RESOURCE_CONFIGURATION": {
"config": {
"newFilestore": {
"filestore": "projects/PROJECT_ID/locations/FILESTORE_INSTANCE_ZONE/instances/FILESTORE_INSTANCE_NAME",
"fileShares": {
"capacityGb": "CAPACITY",
"fileShare": "SHARE_NAME"
},
"tier": "TIER",
"protocol": "PROTOCOL"
}
}
}
},
"computeResources": {
"COMPUTE_RESOURCE_NAME_1": {
"config": {
"newReservedInstances": {
"reservation": "projects/RESERVATION_PROJECT_ID/zones/RESERVATION_ZONE/reservations/RESERVATION_NAME"
}
}
},
"COMPUTE_RESOURCE_NAME_2": {
"config": {
"newSpotInstances": {
"zone": "SPOT_VMS_ZONE",
"machineType": "SPOT_MACHINE_TYPE"
}
}
}
},
"orchestrator": {
"slurm": {
"loginNodes": {
"count": "LOGIN_NODES_COUNT",
"zone": "LOGIN_NODE_ZONE",
"machineType": "LOGIN_NODE_MACHINE_TYPE",
"startupScriptTimeout": "STARTUP_SCRIPT_TIMEOUT"
},
"nodeSets": [
{
"id": "NODESET_NAME_1",
"computeId": "COMPUTE_RESOURCE_NAME_1",
"storageConfigs": [
{
"id": "STORAGE_RESOURCE_CONFIGURATION",
"localMount": "/home"
}
],
"staticNodeCount": "NODESET_1_STATIC_COUNT",
"maxDynamicNodeCount": "NODESET_1_MAX_DYNAMIC_COUNT",
"computeInstance": {
"bootDisk": {
"type": "projects/PROJECT_ID/zones/DISK_ZONE_1/diskTypes/DISK_TYPE_1",
"sizeGb": "DISK_SIZE_1"
},
"startupScriptTimeout": "STARTUP_SCRIPT_TIMEOUT"
}
},
{
"id": "NODESET_NAME_2",
"computeId": "COMPUTE_RESOURCE_NAME_2",
"storageConfigs": [
{
"id": "STORAGE_RESOURCE_CONFIGURATION",
"localMount": "/home"
}
],
"staticNodeCount": "NODESET_2_STATIC_COUNT",
"maxDynamicNodeCount": "NODESET_2_MAX_DYNAMIC_COUNT",
"computeInstance": {
"bootDisk": {
"type": "projects/PROJECT_ID/zones/DISK_ZONE_2/diskTypes/DISK_TYPE_2",
"sizeGb": "DISK_SIZE_2"
},
"startupScriptTimeout": "STARTUP_SCRIPT_TIMEOUT"
}
}
],
"partitions": [
{
"id": "PARTITION_NAME_1",
"nodeSetIds": [
"NODESET_NAME_1"
]
},
{
"id": "PARTITION_NAME_2",
"nodeSetIds": [
"NODESET_NAME_2"
]
}
],
"defaultPartition": "PARTITION_NAME_1"
}
}
}
Replace the following:
PROJECT_ID: the ID of the project where you want to create your cluster and its associated resources.REGION: the region where you want to create your cluster.CLUSTER_NAME: the name of the cluster. The name can contain up to 10 characters, and it can only use numbers or lowercase letters (a-z).NETWORK_NAME: the name of the network that you want to create.STORAGE_RESOURCE_CONFIGURATION: the name of the storage resource configuration.FILESTORE_INSTANCE_ZONE: the zone where you want to create your Filestore instance.FILESTORE_INSTANCE_NAME: the name for your Filestore instance.CAPACITY: the size, in GiB, that you want to allocate for the instance. The value must be between 1,024 GiB (1024) and 102,400 GiB (102400), and it must be in 256 GiB (256) increments. For more information about the supported service tiers and capacity for Filestore instances, see Service tiers.SHARE_NAME: the name for the NFS file share that is served from the instance.TIER: the type of service tier that you want to use for the instance and that Cluster Director supports. Specify one of the following values:For the zonal tier:
ZONALFor the regional tier:
REGIONAL
PROTOCOL: the system protocol for the instance. Specify one of the following values:For NFSv3:
NFSV3For NFSv4.1:
NFSV41
COMPUTE_RESOURCE_NAME_1andCOMPUTE_RESOURCE_NAME_2: the name of the two compute resource configurations.RESERVATION_PROJECT_ID: the ID of the project where the reservation exists. If you want to use a reservation from a different project, then verify that your project is allowed to consume the reservation. For more information, see Allow and restrict projects from creating and modifying shared reservations.RESERVATION_ZONE: the zone where the reservation exists.RESERVATION_NAME: the name of the reservation that you want to use to create VMs. If you use a reservation of A4X VMs, then you can control VM placement. To target a block or sub-block for consumption, change/v1/to/v1beta/in the request URL to call the v1betaclusters.createmethod. Then, innewReservedInstancesfield, replace thereservationfield with one of the following fields:Block: replace the
reservationfield with thereservationBlockfield as follows:"computeResources": { "COMPUTE_RESOURCE_NAME_1": { "config": { "newReservedInstances": { "reservationBlock": "projects/RESERVATION_PROJECT_ID/zones/RESERVATION_ZONE/reservations/RESERVATION_NAME/reservationBlocks/RESERVATION_BLOCK_NAME" } } } }Replace
RESERVATION_BLOCK_NAMEwith the name of the reservation block that you want to use.Sub-block: replace the
reservationattribute with thereservationSubBlockattribute as follows:"computeResources": { "COMPUTE_RESOURCE_NAME_1": { "config": { "newReservedInstances": { "reservationSubBlock": "projects/RESERVATION_PROJECT_ID/zones/RESERVATION_ZONE/reservations/RESERVATION_NAME/reservationSubBlocks/RESERVATION_SUB_BLOCK_NAME" } } } }Replace the following:
RESERVATION_BLOCK_NAME: the name of the reservation block that contains the sub-block.RESERVATION_SUB_BLOCK_NAME: the name of the reservation sub-block that you want to use.
SPOT_VMS_ZONE: the zone where you want to create your Spot VMs. To review the regions and zones where the machine type that you want to use is available, see Available regions and zones.SPOT_MACHINE_TYPE: the machine type to use for the Spot VMs. Specify one of the following machine types:For an A4 machine type:
a4-highgpu-8gFor an A3 Ultra machine type:
a3-ultragpu-8gFor an A3 Mega machine type:
a3-megagpu-8gFor an N2 machine type, see N2 machine series.
LOGIN_NODES_COUNT: the number of compute instances to use for the login nodeset.LOGIN_NODE_ZONE: the zone where you want to create the compute instances in the login nodeset.LOGIN_NODE_MACHINE_TYPE: the machine type that you want the compute instances in the login nodeset to use. If you use A4X Max or A4X instances in your cluster, then specify a C4A or N2 machine type. Otherwise, specify an N2 machine type.STARTUP_SCRIPT_TIMEOUT: the maximum time that the startup script can run, for example300s. The default value is300s(300 seconds, or five minutes). The minimum allowed value is1s(one second).NODESET_NAME_1andNODESET_NAME_2: the name of the two nodesets.NODESET_1_STATIC_COUNTandNODESET_2_STATIC_COUNT: the minimum number of compute instances that must run in each nodeset.NODESET_1_MAX_DYNAMIC_COUNTandNODESET_2_MAX_DYNAMIC_COUNT: the maximum number of compute instances that Cluster Director can add to each nodeset during increases in traffic.DISK_ZONE_1andDISK_ZONE_2: the zone where you want to create the boot disks for the nodesets.DISK_TYPE_1andDISK_TYPE_2: the type of boot disks for the nodesets. Based on the machine type in the node, specify one of the following values:For A4X Max or A4X instances:
hyperdisk-balancedFor A4 instances:
hyperdisk-balancedFor A3 Ultra instances:
hyperdisk-balancedFor A3 Mega instances:
pd-balanced,pd-ssd,hyperdisk-balanced,hyperdisk-ml,hyperdisk-extreme, orhyperdisk-throughputFor N2 instances:
pd-standard,pd-balanced,pd-ssd,pd-extreme,hyperdisk-extreme, orhyperdisk-throughput
For an overview of the different types of boot disks that you can use, see Choose a disk type.
DISK_SIZE_1andDISK_SIZE_2: the size of the boot disks for the two compute nodes in GB. The value must be50or higher.PARTITION_NAME_1andPARTITION_NAME_2: the name of the partitions for your cluster.
To send your request, select one of the following options:
curl (Bash)
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request-body.json \
"https://hypercomputecluster.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/clusters?clusterId=CLUSTER_NAME"
Powershell
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request-body.json `
-Uri "https://hypercomputecluster.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/clusters?clusterId=CLUSTER_NAME" | Select-Object -Expand Content
curl (cmd.exe)
curl -X POST ^
-H "Authorization: Bearer $(gcloud auth print-access-token)" ^
-H "Content-Type: application/json; charset=utf-8" ^
-d @request-body.json ^
"https://hypercomputecluster.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/clusters?clusterId=CLUSTER_NAME"
The response is similar to the following:
{
"name": "projects/example-project/locations/us-central1/operations/operation-1758842430697-63fa86a4c3030-028b6436-2fbda8e1",
"metadata": {
"@type": "type.googleapis.com/google.cloud.hypercomputecluster.v1.OperationMetadata",
"createTime": "2025-09-25T23:20:30.707315354Z",
"target": "projects/example-project/locations/us-central1/clusters/clusterp6a",
"verb": "update",
"requestedCancellation": false,
"apiVersion": "v1"
},
"done": false
}
Creating the cluster can take some time to complete. The completion time depends on the number of compute instances that you request and resource availability in the zone of the compute instances. If your requested resources are unavailable, then Cluster Director maintains the creation request until resources become available. When Cluster Director creates your login node, you can connect to your cluster; however, you can only run workloads when Cluster Director creates the compute nodes in your cluster.