Use reservations with Vertex AI Workbench instances

To ensure that VM resources are available when your Vertex AI Workbench instances need them, you can use Compute Engine reservations. Reservations provide a high level of assurance in obtaining capacity for Compute Engine zonal resources.

Limitations and requirements

All limitations of Compute Engine reservations apply when Vertex AI Workbench instances consume reservations. See How reservations work.

In addition, when using reservations with Vertex AI Workbench instances, the following limitations and requirements apply:

  • Consuming Compute Engine reservations with Vertex AI Workbench instances is in private preview. To request access, see the access request page.

  • Committed use discounts don't apply.

  • Using reservations with Vertex AI Workbench is only available through the Notebooks API. Using reservations with Vertex AI Workbench by using the Google Cloud console isn't supported.

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. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Enable the Compute Engine and Notebooks APIs.

    Enable the APIs

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Enable the Compute Engine and Notebooks APIs.

    Enable the APIs

Required roles

To ensure that your user account has the necessary permissions to use reservations with Vertex AI Workbench instances, ask your administrator to grant your user account the following IAM roles on the project:

For more information about granting roles, see Manage access to projects, folders, and organizations.

Your administrator might also be able to give your user account the required permissions through custom roles or other predefined roles.

Create a reservation

  1. Create a Compute Engine reservation. It can be a single-project reservation or a shared reservation. For more information, see the following documents:

    The reservation can include GPU accelerators.

Use a reservation with a new instance

You can add your reservation when creating a new Vertex AI Workbench instance by using the REST API.

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your project ID
  • LOCATION: the zone where your instance is located
  • INSTANCE_NAME: the name of your instance
  • MACHINE_TYPE: the machine type of your instance
  • RESERVATION_TYPE: the type of reservation; must be RESERVATION_ANY or RESERVATION_SPECIFIC
  • RESERVATION_NAME: the name of your reservation when using the RESERVATION_SPECIFIC type
    • For reservations in the same project, you can use the reservation ID.
    • For reservations in a different project, you must use the full reservation path.

HTTP method and URL:

POST https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances?instanceId=INSTANCE_NAME

Request JSON body:

{
  "gce_setup": {
    "machine_type": "MACHINE_TYPE",
    "reservation_affinity": {
      "consume_reservation_type": "RESERVATION_TYPE",
      "key": "compute.googleapis.com/reservation-name",
      "values": ["RESERVATION_NAME"]
    }
  }
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances?instanceId=INSTANCE_NAME"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances?instanceId=INSTANCE_NAME" | Select-Object -Expand Content
If successful, the response body contains an instance of Operation.

To use any reservation,

{
  "gce_setup": {
    "machine_type": "MACHINE_TYPE",
    "reservation_affinity": {
      "consume_reservation_type": "RESERVATION_ANY"
    }
  }
}

Stop using your reservation

To stop using your reservation, you can delete your reservation.

If you want to continue using your reservation with other resources, but don't want your existing Vertex AI Workbench instance to use it, you must delete the instance.

Billing

Reserved Compute Engine VM resources are billed by Vertex AI Workbench while the Vertex AI Workbench instance is running, and are billed by Compute Engine when the VM resources aren't being used by Vertex AI Workbench.

What's next