Back up and restore data by using a snapshot

This page describes how to use a snapshot to back up and restore the data onyour Vertex AI Workbench instance.

Back up the data

To back up data on a Vertex AI Workbench instance, you can take asnapshot of the underlying Compute Engine virtual machine (VM) data disk.

You can create a snapshot of your instance's data disk by usingthe Google Cloud console, the Google Cloud CLI, or the REST API:

Console

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

    Go to Instances

  2. Click the instance name.

  3. On theInstance details page, clickView in Compute Engineto openVM details.

  4. In theAdditional disks section, click the name of the data disk.The name of the data disk is in this format:INSTANCE_NAME-data-workspace.

  5. ClickCreate snapshot.

  6. In theCreate a snapshot dialog, clickCreate.

Compute Engine creates a snapshot of the data disk.

gcloud

To create a snapshot of your instance's data disk, use thegcloud compute snapshots createcommand.

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

  • SNAPSHOT_NAME: a name for your snapshot
  • SOURCE_ZONE: the zone where your instance is located
  • INSTANCE_NAME: the name of your instance
  • STORAGE_LOCATION: theCloud Storage multi-region or theCloud Storage region where you want to store your snapshot. You can specify only one storage location.

Execute the following command:

Linux, macOS, or Cloud Shell

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudcomputesnapshotscreateSNAPSHOT_NAME\--source-disk-zone=SOURCE_ZONE\--source-disk=INSTANCE_NAME-data-workspace\--storage-location=STORAGE_LOCATION

Windows (PowerShell)

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudcomputesnapshotscreateSNAPSHOT_NAME`--source-disk-zone=SOURCE_ZONE`--source-disk=INSTANCE_NAME-data-workspace`--storage-location=STORAGE_LOCATION

Windows (cmd.exe)

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudcomputesnapshotscreateSNAPSHOT_NAME^--source-disk-zone=SOURCE_ZONE^--source-disk=INSTANCE_NAME-data-workspace^--storage-location=STORAGE_LOCATION

REST

To create a snapshot of your instance's data disk, make aPOSTrequest to Compute Engine'ssnapshots.insertmethod.

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

  • DESTINATION_PROJECT_ID: the ID of the project where you want to create the snapshot
  • SNAPSHOT_NAME: a name for your snapshot
  • SOURCE_PROJECT_ID: the ID of the project where your instance is located
  • SOURCE_ZONE: the zone where your instance is located
  • INSTANCE_NAME: the name of your instance
  • STORAGE_LOCATION: theCloud Storage multi-region or theCloud Storage region where you want to store your snapshot. You can specify only one storage location.

HTTP method and URL:

POST https://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/global/snapshots

Request JSON body:

{  "name": "SNAPSHOT_NAME",  "sourceDisk": "projects/SOURCE_PROJECT_ID/zones/SOURCE_ZONE/disks/INSTANCE_NAME-data-workspace",  "storageLocations": [      "STORAGE_LOCATION"  ],}

To send your request, choose one of these options:

curl

Note: The following command assumes that you have logged in to thegcloud CLI with your user account by runninggcloud init orgcloud auth login , or by usingCloud Shell, which automatically logs you into thegcloud CLI . You can check the currently active account by runninggcloud auth list.

Save the request body in a file namedrequest.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://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/global/snapshots"

PowerShell

Note: The following command assumes that you have logged in to thegcloud CLI with your user account by runninggcloud init orgcloud auth login . You can check the currently active account by runninggcloud auth list.

Save the request body in a file namedrequest.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://compute.googleapis.com/compute/v1/projects/DESTINATION_PROJECT_ID/global/snapshots" | Select-Object -Expand Content

Schedule backup

Preview — Scheduled backups

This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.

A backup schedule can be configured for a workbench instance by attaching aresource policy for the data disk.

You can create an instance with a snapshot schedule attached usingthe Google Cloud CLI or the REST API:

gcloud

To create an instance with a snapshot schedule, use thegcloud workbenchinstances createcommand and specify your resource policies by usingthe--data-disk-resource-policies flag.

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

  • INSTANCE_NAME: the name of your Vertex AI Workbench instance; must start with a letter followed by up to 62 lowercase letters, numbers, or hyphens (-), and cannot end with a hyphen
  • PROJECT_ID: your project ID
  • LOCATION: the zone where you want your instance to be located
  • MACHINE_TYPE: themachine type of your instance's VM, for example:n2d-standard-2
  • REGION: the region where the resource policy is located
  • RESOURCE_POLICY: the resource policy to apply to the data disk.

Execute the following command:

Linux, macOS, or Cloud Shell

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudworkbenchinstancescreateINSTANCE_NAME\--project=PROJECT_ID\--location=LOCATION\--machine-type=MACHINE_TYPE\--data-disk-resource-policies=projects/PROJECT_ID/regions/REGION/resourcePolicies/RESOURCE_POLICY

Windows (PowerShell)

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudworkbenchinstancescreateINSTANCE_NAME`--project=PROJECT_ID`--location=LOCATION`--machine-type=MACHINE_TYPE`--data-disk-resource-policies=projects/PROJECT_ID/regions/REGION/resourcePolicies/RESOURCE_POLICY

Windows (cmd.exe)

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudworkbenchinstancescreateINSTANCE_NAME^--project=PROJECT_ID^--location=LOCATION^--machine-type=MACHINE_TYPE^--data-disk-resource-policies=projects/PROJECT_ID/regions/REGION/resourcePolicies/RESOURCE_POLICY

REST

To create an instance with a snapshot schedule, use theprojects.locations.instances.createmethod and set theresourcePolicies in yourDataDisk.

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

  • PROJECT_ID: your project ID
  • LOCATION: the zone where you want your instance to be located
  • MACHINE_TYPE: themachine type of your instance's VM, for example:n2d-standard-2
  • REGION: the region where the resource policy is located
  • RESOURCE_POLICY: the resource policy to apply to the data disk.

HTTP method and URL:

POST https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances

Request JSON body:

{  "gce_setup": {    "machine_type": "MACHINE_TYPE",    "data_disks": [      {        "resource_policies": [          "projects/PROJECT_ID/regions/REGION/resourcePolicies/RESOURCE_POLICY"        ]      }    ]  }}

To send your request, choose one of these options:

curl

Note: The following command assumes that you have logged in to thegcloud CLI with your user account by runninggcloud init orgcloud auth login , or by usingCloud Shell, which automatically logs you into thegcloud CLI . You can check the currently active account by runninggcloud auth list.

Save the request body in a file namedrequest.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"

PowerShell

Note: The following command assumes that you have logged in to thegcloud CLI with your user account by runninggcloud init orgcloud auth login . You can check the currently active account by runninggcloud auth list.

Save the request body in a file namedrequest.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" | Select-Object -Expand Content

Backup scheduler limitations

Consider the following limitations of scheduled backups when you planyour project:

  • You must add the backup schedule when you create the instance. If your instancewas created without a backup schecule, then backup the existing instance,create a new instance with a backup schedule and restore the instanceusing the backup.

  • The backup schedule on an instance cannot be modified. This includesadding, updating, and removing the backup schedule.

Restore data from a snapshot

You can restore data on an instance by using a snapshot. When you restore dataon an instance, Vertex AI Workbench deletes the existing data disk that isattached to the instance, creates a new data disk based on the snapshot,and attaches the new data disk to the instance.

You can restore data on an instance by using the gcloud CLI orthe REST API:

Caution: Restoring a snapshot is supported only for snapshots of data diskstaken from Vertex AI Workbench instances. Restoring a snapshot thatwas taken from a different source can cause the instance to functionincorrectly.

gcloud

To restore data on an instance, use thegcloud workbench instances restorecommand.

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

  • INSTANCE_NAME: the name of your instance
  • LOCATION: the zone where your instance is located
  • SNAPSHOT_PROJECT_NAME: the project name where your snapshot is located
  • SNAPSHOT_NAME: the name of the snapshot to restore

Execute the following command:

Linux, macOS, or Cloud Shell

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudworkbenchinstancesrestoreINSTANCE_NAME\--location=LOCATION\--snapshot-project=SNAPSHOT_PROJECT_NAME\--snapshot=SNAPSHOT_NAME

Windows (PowerShell)

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudworkbenchinstancesrestoreINSTANCE_NAME`--location=LOCATION`--snapshot-project=SNAPSHOT_PROJECT_NAME`--snapshot=SNAPSHOT_NAME

Windows (cmd.exe)

Note: Ensure you have initialized the Google Cloud CLI with authentication and a project by running eithergcloud init; orgcloud auth login andgcloud config set project.
gcloudworkbenchinstancesrestoreINSTANCE_NAME^--location=LOCATION^--snapshot-project=SNAPSHOT_PROJECT_NAME^--snapshot=SNAPSHOT_NAME

REST

To restore data on an instance, make aPOST request to theprojects.locations.instances.restoremethod.

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_ID: the ID of your instance
  • SNAPSHOT_ID: the ID of the snapshot to restore; to get the ID of a snapshot, use Compute Engine'ssnapshots.get method
  • SNAPSHOT_PROJECT_ID: the project ID of the snapshot

HTTP method and URL:

POST https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances/INSTANCE_ID:restore

Request JSON body:

{  "snapshot": {    {      "snapshotId":SNAPSHOT_ID,      "projectId":SNAPSHOT_PROJECT_ID    }  }}

To send your request, choose one of these options:

curl

Note: The following command assumes that you have logged in to thegcloud CLI with your user account by runninggcloud init orgcloud auth login , or by usingCloud Shell, which automatically logs you into thegcloud CLI . You can check the currently active account by runninggcloud auth list.

Save the request body in a file namedrequest.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/INSTANCE_ID:restore"

PowerShell

Note: The following command assumes that you have logged in to thegcloud CLI with your user account by runninggcloud init orgcloud auth login . You can check the currently active account by runninggcloud auth list.

Save the request body in a file namedrequest.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/INSTANCE_ID:restore" | Select-Object -Expand Content

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.