Delete a persistent resource

Persistent resources are available until they are deleted. Once deleted, there is no guarantee that you can create the persistent resource of the same resource type again if there is a stockout. This page shows you how to delete a persistent resource by using the Google Cloud console, Google Cloud CLI, Vertex AI SDK for Python, and the REST API.

Required roles

To get the permission that you need to delete a persistent resource, ask your administrator to grant you the Vertex AI Administrator (roles/aiplatform.admin) IAM role on your project. For more information about granting roles, see Manage access.

This predefined role contains the aiplatform.persistentResources.delete permission, which is required to delete a persistent resource.

You might also be able to get this permission with custom roles or other predefined roles.

Delete a persistent resource

For instructions on how to delete a persistent resource when you no longer needed it, select one of the following tabs. Note that if there are custom jobs running on the persistent resource when you delete it, those custom jobs are automatically cancelled before the persistent resource is deleted.

Console

To delete a persistent resource in the Google Cloud console, do the following:

  1. In the Google Cloud console, go to the Persistent resources page.

    Go to Persistent resources

  2. Click the name of the persistent resource that you want to delete.

  3. Click Delete.

  4. Click Confirm.

gcloud

Before using any of the command data below, make the following replacements:

  • PROJECT_ID: The Project ID of the persistent resource that you want to delete.
  • LOCATION: The region of the persistent resource that you want to delete.
  • PERSISTENT_RESOURCE_ID: The ID of the persistent resource that you want to delete.

Execute the following command:

Linux, macOS, or Cloud Shell

gcloud ai persistent-resources delete PERSISTENT_RESOURCE_ID \
    --project=PROJECT_ID \
    --region=LOCATION

Windows (PowerShell)

gcloud ai persistent-resources delete PERSISTENT_RESOURCE_ID `
    --project=PROJECT_ID `
    --region=LOCATION

Windows (cmd.exe)

gcloud ai persistent-resources delete PERSISTENT_RESOURCE_ID ^
    --project=PROJECT_ID ^
    --region=LOCATION

You should receive a response similar to the following:

Using endpoint [http://us-central1-aiplatform.googleapis.com/]
Request to delete the PersistentResource [projects/sample-project/locations/us-central1/persistentResources/test-persistent-resource] has been sent.

You may view the status of your persistent resource with the command

  $ gcloud ai persistent-resources describe projects/sample-project/locations/us-central1/persistentResources/test-persistent-resource

Python

Before trying this sample, follow the Python setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI Python API reference documentation.

To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

resource_to_delete = persistent_resource.PersistentResource(
    EXAMPLE_PERSISTENT_RESOURCE_ID
)

# Delete the persistent resource.
resource_to_delete.delete(sync=SYNC)

REST

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

  • PROJECT_ID: The Project ID of the persistent resource that you want to delete.
  • LOCATION: The region of the persistent resource that you want to delete.
  • PERSISTENT_RESOURCE_ID: The ID of the persistent resource that you want to delete.

HTTP method and URL:

DELETE http://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/persistentResources/PERSISTENT_RESOURCE_ID

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/123456789012/locations/us-central1/operations/1234567890123456789",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.DeleteOperationMetadata",
    "genericMetadata": {
      "createTime": "2023-07-28T17:22:08.316883Z",
      "updateTime": "2023-07-28T17:22:08.316883Z"
    }
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.protobuf.Empty"
  }
}

What's next