Configuring node pool capacity blocks on AWS

After you create a hosted cluster, you can configure node pool capacity blocks for graphics processing unit (GPU) reservations on Amazon Web Services (AWS).

Procedure
  1. Create GPU reservations on AWS by running a command similar to the following example:

    Important

    The zone of the GPU reservation must match your hosted cluster zone.

    $ aws ec2 describe-capacity-block-offerings \
          --instance-type "p4d.24xlarge"\
          --instance-count  "1" \
          --start-date-range "$(date -u +"2025-07-21T10:14:39Z")"  \
          --end-date-range "$(date -u -d "2 day" +"2025-07-22T10:16:36Z")" \
          --capacity-duration-hours 24 \
          --output json
    • --instance-type defines the type of your AWS instance.

    • --instance-count defines your instance purchase quantity. Valid values are integers ranging from 1 to 64.

    • --start-date-range defines the start date range.

    • --end-date-range defines the end date range.

    • --capacity-duration-hours defines the duration of capacity blocks in hours.

  2. Purchase the minimum fee capacity block by running the following command:

    $ aws ec2 purchase-capacity-block \
          --capacity-block-offering-id "${MIN_FEE_ID}" \
          --instance-platform "Linux/UNIX"\
          --tag-specifications 'ResourceType=capacity-reservation,Tags=[{Key=usage-cluster-type,Value=hypershift-hosted}]' \
          --output json   > "${CR_OUTPUT_FILE}"
    • --capacity-block-offering-id defines the ID of the capacity block offering.

    • --instance-platform defines the platform of your instance.

    • --tag-specifications defines the tag for your instance.

  3. Create an environment variable to set the capacity reservation ID by running the following command:

    $ CB_RESERVATION_ID=$(jq -r '.CapacityReservation.CapacityReservationId' "${CR_OUTPUT_FILE}")

    Wait for a couple of minutes for the GPU reservation to become available.

  4. Add a node pool to use the GPU reservation by running the following command:

    $ hcp create nodepool aws \
      --cluster-name <hosted_cluster_name> \
      --name <node_pool_name> \
      --node-count <node_pool_count> \
      --instance-type <instance_type> \
      --arch <arch_type> \
      --release-image <release_image> \
      --render > /tmp/np.yaml
    • --cluster-name specifies the name of your hosted cluster.

    • --name specifies the name of your node pool.

    • --node-count defines the node pool count, for example, 1.

    • --instance-type defines the instance type, for example, p4d.24xlarge.

    • --arch defines an architecture type, for example, amd64.

    • --release-image specifies the release image you want to use.

  5. Add the capacityReservation setting in your NodePool resource by using the following example configuration:

    # ...
    spec:
      arch: amd64
      clusterName: cb-np-hcp
      management:
        autoRepair: false
        upgradeType: Replace
      platform:
        aws:
          instanceProfile: cb-np-hcp-dqppw-worker
          instanceType: p4d.24xlarge
          rootVolume:
            size: 120
            type: gp3
          subnet:
            id: subnet-00000
          placement:
            capacityReservation:
              id: ${CB_RESERVATION_ID}
              marketType: CapacityBlocks
        type: AWS
    # ...
  6. Apply the node pool configuration by running the following command:

    $ oc apply -f /tmp/np.yaml
Verification
  1. Verify that your new node pool is created successfully by running the following command:

    $ oc get np -n clusters
    Example output
    NAMESPACE   NAME    CLUSTER     DESIRED NODES   CURRENT  NODES   AUTOSCALING     AUTOREPAIR   VERSION                               UPDATINGVERSION   UPDATINGCONFIG   MESSAGE
    clusters    cb-np   cb-np-hcp   1               1                False           False        4.22.0-0.nightly-2025-06-05-224220    False             False
  2. Verify that your new compute nodes are created in the hosted cluster by running the following command:

    $ oc get nodes
    Example output
    NAME                           STATUS   ROLES    AGE    VERSION
    ip-10-0-132-74.ec2.internal    Ready    worker   17m    v1.35.4
    ip-10-0-134-183.ec2.internal   Ready    worker   4h5m   v1.35.4