Bulk create HPC-optimized instances that use RDMA


This tutorial shows you how to create a large number of high performance computing (HPC) virtual machine (VM) instances that are identical and independent from each other. The instances use H4D HPC-optimized machine types and run on reserved blocks of capacity. This tutorial also shows how to configure the H4D instances to use Cloud RDMA.

This tutorial is intended for HPC engineers, platform administrators and operators, and for data and MPI specialists who are interested in creating a cluster of interconnected HPC instances. The resulting instances don't use an orchestrator for instance management or job scheduling.

Objectives

  1. Reserve blocks of capacity for your deployment.
  2. Optional: Create a placement policy if you aren't creating the VMs on the same block or sub-block.
  3. Create Virtual Private Cloud networks.
  4. Create RDMA-enabled instances in bulk.
  5. Clean up.

Costs

This tutorial uses billable components of Google Cloud, including:

To generate a cost estimate based on your projected usage, use the Pricing Calculator.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. Install the Google Cloud CLI.

  3. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  4. To initialize the gcloud CLI, run the following command:

    gcloud init
  5. Create or select a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.
    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the required API:

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    gcloud services enable compute.googleapis.com
  8. Install the Google Cloud CLI.

  9. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  10. To initialize the gcloud CLI, run the following command:

    gcloud init
  11. Create or select a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.
    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  12. Verify that billing is enabled for your Google Cloud project.

  13. Enable the required API:

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    gcloud services enable compute.googleapis.com
  14. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/compute.instanceAdmin.v1,roles/compute.networkAdmin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_IDENTIFIER" --role=ROLE

    Replace the following:

    • PROJECT_ID: your project ID.
    • USER_IDENTIFIER: the identifier for your user account—for example, myemail@example.com.
    • ROLE: the IAM role that you grant to your user account.

Reserve blocks of capacity for your deployment

This document explains how to reserve blocks of capacity by asking your account team to create a future reservation request for you. Use this reservation type to obtain capacity for dense deployment of VM instances. For an overview of all consumption options, see:

This action lets you reserve blocks of capacity for a defined duration, starting on a specific date and time that you choose. Based on your request, Google creates a draft future reservation request. After you review and submit this draft request, and Google Cloud approves it, Compute Engine automatically creates (auto-creates) an empty reservation. Then, at your chosen start time, Compute Engine provisions your requested capacity into the auto-created reservation. You can then use the reservation to create virtual machine (VM) instances until the reservation period ends.

As part of the future reservation request process, Google manages quota for your reserved resources. You don't need to request quota. At the start time of your approved future reservation, Google increases your quota if you lack it for the reserved resources.

To reserve blocks of capacity, complete the following steps:

  1. Contact your account team and provide the following information for Google to create a draft future reservation request:

    • Project number: the number of the project where your account team creates the request and Compute Engine provisions the capacity. For information about how to find your project number, see Find the project name, number, and ID in the Resource Manager documentation.

    • Machine type: one of the H4D HPC-optimized machine types

    • Total count: the total number of VMs to reserve. You can only reserve multiples of two VMs. Block sizes and VM count per block vary based on machine type and availability. Your account team can provide more details for your request.

    • Zone: the zone where you want to reserve capacity. To review the available regions and zones for the H4D machine series, see Available regions and zones and select H4D in the Select a machine series list.

    • Start time: the start time of the reservation period. Format the start time as an RFC 3339 timestamp:

      YYYY-MM-DDTHH:MM:SSOFFSET
      

      Replace the following:

      • YYYY-MM-DD: a date formatted as a four-digit year, two-digit month, and a two-digit day of the month, separated by hyphens (-).

      • HH:MM:SS: a time formatted as a two-digit hour by using a 24-hour time, two-digit minutes, and two-digit seconds, separated by colons (:).

      • OFFSET: the time zone formatted as an offset of Coordinated Universal Time (UTC). For example, to use the Pacific Standard Time (PST), specify -08:00. To use no offset, specify Z.

    • End time: the end time of the reservation period. Format it as an RFC 3339 timestamp.

    • Share type: whether only your project can use the auto-created reservation (LOCAL), or other projects can use the reservation (SPECIFIC_PROJECTS).

      To share reserved capacity with other projects in your organization, do the following:

      1. If you haven't already, then verify that the project where Google creates the request is allowed to create shared reservations.

      2. Provide the numbers of the projects to share the reserved capacity with. You can specify up to 100 projects in your organization.

    • Reservation name: the name of the reservation that Compute Engine automatically creates to deliver your reserved capacity. Compute Engine only creates specifically targeted reservations.

    • Commitment name: if your reservation period is one year or longer, then you must purchase and attach a resource-based commitment to your reserved resources. You can purchase a commitment with a 1-year or 3-year plan. If you share the reserved capacity with other projects, then those projects get discounts only if they use the same Cloud Billing account as the project where you reserve capacity. For details, see Enable CUD sharing for resource-based commitments.

  2. Google creates a draft future reservation request and your account team contacts you.

  3. Review the draft request. Take note of the following when reviewing the reservation request:

    • You can start using the reserved capacity only after the specified start date and time.
    • When the specified end time is reached, Compute Engine does the following:

      • Deletes the auto-created reservation.
      • Stops or deletes any VMs that use the reservation. The action taken is based on the termination action that you specify when creating the VMs.
    • You can't change whether the reserved capacity is shared after you submit the reservation request.

    To review a draft future reservation request, select one of the following options:

    Console

    1. In the Google Cloud console, go to the Reservations page.

      Go to Reservations

    2. Click the Future reservations tab. The Future Reservations table lists each future reservation request in your project, and each table column describes a property.

    3. In the Name column, click the name of the draft request that Google created for you. A page that gives the details of the future reservation request opens.

    4. In the Basic information section, verify that the request details, such as Dates and Share type, are correct. Also, if you requested a commitment, verify that it's specified.

    5. If any of these details are incorrect, then contact your account team.

    gcloud

    1. To view a list of future reservation requests in your project, use the gcloud beta compute future-reservations list command with the --filter flag set to PROCUREMENT_STATUS=DRAFTING:

      gcloud beta compute future-reservations list --filter=PROCUREMENT_STATUS=DRAFTING
      
    2. In the command output, look for the reservation request that has the name that you provided to your account team.

    3. To view the details of the draft request, use the gcloud beta compute future-reservations describe command:

      gcloud beta compute future-reservations describe FUTURE_RESERVATION_NAME \
          --zone=ZONE
      

      Replace the following:

      • FUTURE_RESERVATION_NAME: the name of the draft future reservation request.
      • ZONE: the zone where Google created the request.

      The output is similar to the following:

      autoCreatedReservationsDeleteTime: '2026-02-10T19:20:00Z'
      creationTimestamp: '2025-11-27T11:14:58.305-08:00'
      deploymentType: DENSE
      id: '7979651787097007552'
      kind: compute#futureReservation
      name: example-draft-request
      planningStatus: DRAFT
      reservationName: example-reservation
      schedulingType: INDEPENDENT
      selfLink: https://www.googleapis.com/compute/beta/projects/example-project/zones/europe-west4-b/futureReservations/example-draft-request
      selfLinkWithId: https://www.googleapis.com/compute/beta/projects/example-project/zones/europe-west4-b/futureReservations/7979651787097007552
      specificReservationRequired: true
      specificSkuProperties:
        instanceProperties:
          localSsds:
          - diskSizeGb: '375'
            interface: NVME
          ...
        machineType: h4d-highmem-192-lssd
      totalCount: '2'
      status:
        autoCreatedReservations:
        - https://www.googleapis.com/compute/beta/projects/example-project/zones/europe-west4-b/reservations/example-reservation
        fulfilledCount: '2'
        lockTime: '2026-01-27T19:15:00Z'
        procurementStatus: DRAFTING
      timeWindow:
        endTime: '2026-02-10T19:20:00Z'
        startTime: '2026-01-27T19:20:00Z'
      zone: https://www.googleapis.com/compute/beta/projects/example-project/zones/europe-west4-b
      
    4. In the command output, verify that the request details, such as the reservation period and share type, are correct. Additionally, if you purchased a commitment, verify that it's specified.

    5. If the details are incorrect, then contact your account team.

    REST

    1. To view a list of future reservation requests in your project, make a GET request to the beta futureReservations.list method. In the request URL, include the filter query parameter and set it to status.procurementStatus=DRAFTING:

      GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations?filter=status.procurementStatus=DRAFTING
      

      Replace the following:

      • PROJECT_ID: the ID of the project where Google created the draft future reservation request.
      • ZONE: the zone where request exists.
    2. In the request output, look for the reservation request that has the name that you provided to your account team.

    3. To view the details of the draft request, make a GET request to the beta futureReservations.get method:

      GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations/FUTURE_RESERVATION_NAME
      

      Replace FUTURE_RESERVATION_NAME with the name of the draft future reservation request.

      The output is similar to the following:

      {
        "specificSkuProperties": {
          "instanceProperties": {
            "machineType": "h4d-highmem-192-lssd",
            "localSsds": [
              {
                "diskSizeGb": "375",
                "interface": "NVME"
              },
              ...
            ]
          },
          "totalCount": "2"
        },
        "kind": "compute#futureReservation",
        "id": "7979651787097007552",
        "creationTimestamp": "2025-11-27T11:14:58.305-08:00",
        "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/europe-west4-b/futureReservations/example-draft-request",
        "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/example-project/zones/europe-west4-b/futureReservations/7979651787097007552",
        "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/europe-west4-b",
        "name": "example-draft-request",
        "timeWindow": {
          "startTime": "2026-01-27T19:20:00Z",
          "endTime": "2026-02-10T19:20:00Z"
        },
        "status": {
          "procurementStatus": "DRAFTING",
          "lockTime": "2026-01-27T19:15:00Z"
        },
        "planningStatus": "DRAFT",
        "specificReservationRequired": true,
        "reservationName": "example-reservation",
        "deploymentType": "DENSE",
        "schedulingType": "INDEPENDENT",
        "autoCreatedReservationsDeleteTime": "2026-02-10T19:20:00Z"
      }
      
    4. In the output, verify that the request details, such as the reservation period and share type, are correct. Additionally, if you requested a commitment, verify that it's specified.

    5. If the details are incorrect, then contact your account team.

  4. If everything looks correct, then submit the reservation request. You must submit the request before the request start time.

    To submit a draft future reservation request, select one of the following options:

    Console

    1. In the Google Cloud console, go to the Reservations page.

      Go to Reservations

    2. Click the Future reservations tab.

    3. In the Name column, click the name of the draft request that Google created for you.

    4. Click Submit.

    gcloud

    To submit the draft request for review, use the gcloud beta compute future-reservations update command with the --planning-status flag set to SUBMITTED:

    gcloud beta compute future-reservations update FUTURE_RESERVATION_NAME \
        --planning-status=SUBMITTED \
        --zone=ZONE
    

    REST

    To submit the draft request for review, make a PATCH request to the beta futureReservations.update method. In the request URL, include the updateMask query parameter and set it to planningStatus:

    PATCH https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations/FUTURE_RESERVATION_NAME?updateMask=planningStatus
    
    {
      "name": "FUTURE_RESERVATION_NAME",
      "planningStatus": "SUBMITTED"
    }
    
  5. Google Cloud immediately approves your submitted request.

  6. Compute Engine creates an empty reservation with your requested resources.

  7. To view the reservation, see View reserved capacity in the AI Hypercomputer documentation.

Optional: Create a placement policy

Use a placement policy if you want your VMs to be placed as close to each other as possible. However, if you want your VMs to be on a specific block, skip this step and provide the name of the required block during bulk creation of VMs.

Instances that communicate using Cloud RDMA must be located in a single zone, and, more stringently, within a single cluster fabric. You can create a compact placement policy and specify a max distance value to set the minimum compactness within a zone. There is a limit to the number of instances you can assign the compact placement policy to when you specify a max distance value, and the limit changes depending on what value you choose.

To create a compact placement policy, select one of the following options:

gcloud

To create a compact placement policy, use the gcloud beta compute resource-policies create group-placement command.

gcloud beta compute resource-policies create group-placement POLICY_NAME \
--collocation=collocated \
--max-distance=MAX_DISTANCE \
--region=REGION

Replace the following:

  • POLICY_NAME: the name of the compact placement policy
  • MAX_DISTANCE: the maximum distance configuration for your VM instances. Specify 3 to place the VMs in adjacent blocks, and 2 to place the VMs in the same block. VM placement is done on a best effort.
  • REGION: the region where you want to create the placement policy. Specify a region in which the machine type that you want to use is available. For information about available regions, see Available regions and zones.

REST

To create a compact placement policy, make a POST request to the beta.resourcePolicies.insert method. In the request body, include the collocation field set to COLLOCATED, and the maxDistance field.

POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/regions/REGION/resourcePolicies
{
    "name": "POLICY_NAME",
    "groupPlacementPolicy": {
        "collocation": "COLLOCATED",
        "maxDistance": "MAX_DISTANCE"
    }
}

Replace the following:

  • PROJECT_ID: your project ID
  • REGION: the region where you want to create the placement policy. Specify a region in which the machine type that you want to use is available. For information about available regions, see Available regions and zones.
  • POLICY_NAME: the name of the compact placement policy
  • MAX_DISTANCE: the maximum distance configuration for your VM instances. Specify 3 to place the VMs in adjacent blocks, and specify 2 to place the VMs in the same block. VM placement is done on a best effort.

Create Virtual Private Cloud networks

RDMA-enabled instances require a minimum of two network interfaces (NICs):

  • NIC type GVNIC: uses the gve driver for TCP/IP and Internet traffic for normal VM-VM and VM-Internet communication
  • NIC type IRDMA: uses IDPF/iRDMA drivers for RDMA network communication between instances

Instances that use Cloud RDMA can have only one IRDMA interface. You can add up to eight additional GVNIC network interfaces for a total of 10 NICs per instance.

Review the following rules for configuring a network interface for an instance:

  • Each network interface must connect to a different Virtual Private Cloud network.
  • To configure an IRDMA network interface, you must first create a VPC network with the Falcon RDMA network profile in the same region and zone as the instance.
  • For the GVNIC network interface, if you don't specify a network or subnet, Compute Engine uses the default VPC network and the auto subnet that's in the same region as the instance.
  • If you specify a subnet but don't specify a network, Compute Engine infers the network from the subnet specified.
  • If you specify a network, then you must specify a subnet and it must belong to the same network. Otherwise, instance creation fails.

To set up the Falcon Virtual Private Cloud (VPC) networks to use with your instances, you can either follow the documented instructions or use the provided script.

Instruction guides

To create the networks, you can use the following instructions:

Script

You can create up to nine GVNIC network interfaces and one IRDMA network interface per instance. Each network interface must attach to a separate network. To create the networks, you can use the following script, which creates two networks for GVNIC and one network for IRDMA that uses the Falcon VPC network profile.

  1. Optional: Before running the script, list the Falcon VPC network profiles to verify there is one available. Falcon VPC network profiles aren't available in all zones.

    gcloud beta compute network-profiles list --filter=falcon
    
  2. Copy the following code and run it in a Linux shell window.

#!/bin/bash

# Create standard VPC (networks and subnets) for the two GVNIC interfaces
  for N in $(seq 0 1); do
    gcloud compute networks create GVNIC_NAME_PREFIX-net-$N \
        --subnet-mode=custom

    gcloud compute networks subnets create GVNIC_NAME_PREFIX-sub-$N \
        --network=GVNIC_NAME_PREFIX-net-$N \
        --region=<var>REGION</var> \
        --range=10.$N.0.0/16

    gcloud compute firewall-rules create GVNIC_NAME_PREFIX-internal-$N \
        --network=GVNIC_NAME_PREFIX-net-$N \
        --action=ALLOW \
        --rules=tcp:0-65535,udp:0-65535,icmp \
        --source-ranges=10.0.0.0/8
done

# Create SSH firewall rules
gcloud compute firewall-rules create GVNIC_NAME_PREFIX-ssh \
  --network=GVNIC_NAME_PREFIX-net-0 \
  --action=ALLOW \
  --rules=tcp:22 \
  --source-ranges=IP_RANGE

# Optional: Create a firewall rule for the external IP address for the
#  first GVNIC network interface
gcloud compute firewall-rules create GVNIC_NAME_PREFIX-allow-ping-net-0 \
  --network=GVNIC_NAME_PREFIX-net-0 \
  --action=ALLOW \
  --rules=icmp \
  --source-ranges=IP_RANGE

# Create a network for the RDMA over Falcon network interface
gcloud beta compute networks create RDMA_NAME_PREFIX-irdma \
  --network-profile=ZONE-vpc-falcon \
  --subnet-mode custom

# Create a subnet for the RDMA network
gcloud beta compute networks subnets create RDMA_NAME_PREFIX-irdma-sub \
    --network=RDMA_NAME_PREFIX-irdma \
    --region=REGION \
    --range=10.2.0.0/16
# offset to avoid overlap with GVNIC subnet ranges

Replace the following:

  • GVNIC_NAME_PREFIX: the name prefix to use for the standard VPC network and subnet that uses a GVNIC NIC type.
  • REGION: the region where you want to create the networks. This must correspond to the zone specified for the --network-profile flag, when creating the Falcon VPC. For example, if you specify the zone as europe-west4-b, then your region is europe-west4.
  • IP_RANGE: the range of IP addresses outside of the VPC network to use for the SSH firewall rules. As a best practice, specify the specific IP address ranges that you need to allow access from, rather than all IPv4 or IPv6 sources. Don't use 0.0.0.0/0 or ::/0 as a source range because this allows traffic from all IPv4 or IPv6 sources, including sources outside of Google Cloud.
  • RDMA_NAME_PREFIX: the name prefix to use for the VPC network and subnet that uses the IRDMA NIC type.
  • ZONE: the zone where you want to create the networks and compute instances. Use either us-central1-a or europe-west4-b.

Create RDMA-enabled instances in bulk

Review the following limitations before creating H4D instances with Cloud RDMA:

  • You can't use Live migration during host maintenance events with instances that have a Cloud RDMA network interface. You must configure the instance to terminate during maintenance events.
  • You can use only IPv4 addresses with RDMA network interfaces and VPC networks with a Falcon RDMA network profile.
  • You can use only the H4D machine series to create HPC-optimized instances with Cloud RDMA.

The following steps show how to create RDMA-enabled instances in bulk with the first two network interfaces configured as GVNIC interfaces, and the third network interface configured as an IRDMA network interface:

gcloud

Use the gcloud compute instances create command with three --network-interface flags, two for GVNIC interfaces and one for the IRDMA interface. If you chose to use a compact placement policy, also add the following flag: --resource-policies=POLICY_NAME. Replace POLICY_NAME with the name of the compact placement policy. You can customize the rest of the instance options, as needed.

gcloud compute instances bulk create \
    --name-pattern=NAME_PATTERN \
    --count=COUNT \
    --machine-type=MACHINE_TYPE \
    --image-family=IMAGE_FAMILY \
    --image=project= IMAGE_PROJECT \
    --reservation-affinity=specific \
    --reservation=RESERVATION \
    --provisioning-model=RESERVATION_BOUND \
    --instance-termination=action=DELETE \
    --maintenance-policy=TERMINATE \
    --region=REGION \
    --boot-disk-type=hyperdisk-balanced \
    --boot-disk-size=DISK_SIZE \
    --scopes=cloud-platform \
    --network-interface=nic-type=GVNIC, \
        network=GVNIC_NAME_PREFIX-net-0, \
        subnet=GVNIC_NAME_PREFIX-sub-0, \
        stack-type=STACK_TYPE, \
        address=EXTERNAL_IPV4_ADDRESS \
    --network-interface=nic-type=GVNIC, \
        network=GVNIC_NAME_PREFIX-net-1, \
        subnet=GVNIC_NAME_PREFIX-sub-1, no-address \
    --network-interface=nic-type=IRDMA, \
        network=RDMA_NAME_PREFIX-irdma, \
        subnet=RDMA_NAME_PREFIX-irdma-sub, \
        stack-type=IPV4_ONLY, no-address

Replace the following:

  • NAME_PATTERN: the name pattern for the instances. For example, using vm-# for the name pattern generates instances with names such as vm-1 and vm-2, up to the number specified by the --count flag.
  • COUNT: the number of instances to create.
  • MACHINE_TYPE: the machine type to use for the instances. Use one of the H4D machine types, for example h4d-highmem-192-lssd.
  • IMAGE_FAMILY: the image family of the OS image that you want to use, for example rocky-linux-9-optimized-gcp. For a list of supported OS images, see Supported operating system. Choose an OS image version that supports the IRDMA interface.
  • IMAGE_PROJECT: the project ID for the OS image, for example, rocky-linux-cloud.
  • RESERVATION: for this value, you can specify one of the following:

    • If you are using a placement policy or if VMs can be placed anywhere in your reservation block, then specify the reservation name, for example, h4d-highmem-exfr-prod.
    • If you want the instances placed in a specific block and you aren't using a compact placement policy, then specify a reservation block name using the format RESERVATION_NAME/reservationBlocks/RESERVATION_BLOCK_NAME, for example,h4d-highmem-exfr-prod/reservationBlocks/h4d-highmem-exfr-prod-block-1`.

    To view the reservation name or the available reservation blocks, see View capacity.

  • REGION: specify a region in which the machine type that you want to use is available, for example europe-west1. For information about available regions, see Available regions and zones.

  • DISK_SIZE: Optional: the size of the boot disk in GiB. The value must be a whole number.

  • GVNIC_NAME_PREFIX: the name prefix you used when creating the VPC network and subnet for the GVNIC interface.

    For the GVNIC network interface, you can omit the network and subnet flags to use the default network instead.

  • STACK_TYPE: Optional: the stack type for the GVNIC network interface. STACK_TYPE must be one of: IPV4_ONLY, or IPV4_IPV6. The default value is IPV4_ONLY.

  • EXTERNAL_IPV4_ADDRESS: Optional: a static external IPv4 address to use with the network interface. You must have previously reserved an external IPv4 address. Do one of the following:

    • Specify a valid IPv4 address from the subnet.
    • Use the flag no-address instead if you don't want the network interface to have an external IP address.
    • Specify address='' if you want the interface to receive an ephemeral external IP address.

    To specify an external IPv6 address, use the flag --external-ipv6-address instead.

  • RDMA_NAME_PREFIX: the name prefix you used when creating the VPC network and subnet for the IRDMA interface.

REST

To create RDMA-enabled instances in bulk, make a POST request to the beta instances.bulkInsert method with the following settings:

  • Include the networkInterfaces object with at least two network configurations, one for the gVNIC network interface and one for the RDMA network interface.
  • If you chose to use a compact placement policy, also add the resourcePolicies object to the request body.
  • To use the reserved blocks of capacity when creating the instances, set the provisioningModel to RESERVATION_BOUND.
  • You can customize the rest of the instance properties, as needed.
POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instances/bulkInsert
{
  "namePattern":"NAME_PATTERN",
  "count":"COUNT",
  "instanceProperties":{
    "machineType":"MACHINE_TYPE",
    "disks":[
      {
        "boot":true,
        "initializeParams":{
          "diskSizeGb":"DISK_SIZE",
          "diskType":"hyperdisk-balanced",
          "sourceImage":"projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY"
        },
        "mode":"READ_WRITE",
        "type":"PERSISTENT"
      }
    ],
    "networkInterfaces": [
      {
          "network": "GVNIC_NAME_PREFIX-net-0",
          "subnetwork": "GVNIC_NAME_PREFIX-sub-0",
          "accessConfigs": [
            {
                "type": "ONE_TO_ONE_NAT",
                "name": "External IP",
                "natIP": "EXTERNAL_IPV4_ADDRESS"
            }
          ],
          "stackType": "IPV4_ONLY",
          "nicType": "GVNIC",
      },
      {
          "network": "GVNIC_NAME_PREFIX-net-1",
          "subnetwork": "GVNIC_NAME_PREFIX-sub-1",
          "stackType": "IPV4_ONLY",
          "nicType": "GVNIC",
      },
      {
          "network": "RDMA_NAME_PREFIX-irdma",
          "subnetwork": "RDMA_NAME_PREFIX-irdma-sub",
          "stackType": "IPV4_ONLY",
          "nicType": "IRDMA",
      }
    ],
    "reservationAffinity":{
        "consumeReservationType":"SPECIFIC_RESERVATION",
        "key":"compute.googleapis.com/reservation-name",
        "values":[
            "RESERVATION"
        ],
        "scheduling":{
            "provisioningModel":"RESERVATION_BOUND",
            "instanceTerminationAction":"DELETE",
            "onHostMaintenance": "TERMINATE",
            "automaticRestart":true
        }
    },
    ...
  }
}

Complete the following steps:

  1. Replace the following in the request body:

    • PROJECT_ID: the project ID of the project where you want to create the instances.
    • ZONE: specify a zone in which the machine type that you want to use is available. If you are using a compact placement policy, then use a zone in the same region as the compact placement policy. For information about the regions where H4D machine types are available, see Available regions and zones.
    • NAME_PATTERN: the name pattern for the instances. For example, using vm-# for the name pattern generates instances with names such as vm-1 and vm-2, up to the number specified by the count field.
    • COUNT: the number of instances to create.
    • MACHINE_TYPE: the machine type to use for the instances. Use one of the H4D machine types, for example h4d-highmem-192-lssd.
    • DISK_SIZE: the size of the boot disk in GiB.
    • IMAGE_PROJECT: the project ID for the OS image, for example, debian-cloud.
    • IMAGE_FAMILY: the image family of the OS image that you want to use, for example rocky-linux-9-optimized-gcp. For a list of supported OS images, see Supported operating system. Choose an OS image version that supports the IRDMA interface.
    • GVNIC_NAME_PREFIX: the name prefix you used when creating the VPC network and subnet for the GVNIC interface

      For the GVNIC network interface, you can omit the network and subnetwork fields to use the default network instead.

    • EXTERNAL_IPV4_ADDRESS: Optional: a static external IPv4 address to use with the network interface. You must have previously reserved an external IPv4 address.

    • RDMA_NAME_PREFIX: the name prefix you used when creating the VPC network and subnet for the IRDMA interface.

    • RESERVATION: for this value, you can specify one of the following:

      • If you are using a placement policy or if VMs can be placed anywhere in your reservation block, then specify the reservation name, for example, h4d-highmem-exfr-prod.
      • If you want the instances placed in a specific block and you aren't using a compact placement policy, then specify a reservation block name as RESERVATION_NAME/reservationBlocks/RESERVATION_BLOCK_NAME, for example,h4d-highmem-exfr-prod/reservationBlocks/h4d-highmem-exfr-prod-block-1`.

      To view the reservation name or the available reservation blocks, see View capacity.

  2. Optional: If you are using a compact placement policy, replace ... in the request body with the following field:

    "resourcePolicies": [
        "projects/PROJECT_ID/regions/REGION/resourcePolicies/POLICY_NAME"
    ],
    

    Replace the following:

    • PROJECT_ID: the project ID of the compact placement policy.
    • REGION: the region of the compact placement policy.
    • POLICY_NAME: the name of the compact placement policy.
  3. Submit the request.

Clean up

To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, either delete the project that contains the resources, or keep the project and delete the individual resources.

Delete your project

Delete a Google Cloud project:

gcloud projects delete PROJECT_ID

Delete the resources

  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Select the rows that contain the VM instances that you created in this tutorial.

  3. Click Delete, and then click Delete to confirm.

  4. To delete the placement policy, use the gcloud compute resource-policies delete command.

    gcloud compute resource-policies delete POLICY_NAME \
        --region=REGION
    

    Replace the following:

    • POLICY_NAME: the name of the placement policy
    • REGION: the region where the placement policy is located

What's next