A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/compute/docs/disks/scheduled-snapshots below:

Create schedules for disk snapshots | Compute Engine Documentation

Skip to main content Create schedules for disk snapshots

Stay organized with collections Save and categorize content based on your preferences.

Linux Windows

You create a snapshot schedule to regularly and automatically back up zonal and regional Persistent Disk and Google Cloud Hyperdisk volumes. Use snapshot schedules as a best practice to back up your Compute Engine workloads.

If you want to create a snapshot schedule that captures the state of the application data at the time of back up, also referred to as an application consistent, guest-flush, or VSS snapshot, see Create Linux application consistent disk snapshots or Create a Windows application consistent disk snapshot.

For more information about the snapshot schedule properties, see Snapshot schedule properties.

Before you begin Required roles and permissions

To get the permissions that you need to create a snapshot schedule, ask your administrator to grant you the following IAM roles on the project:

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

These predefined roles contain the permissions required to create a snapshot schedule. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to create a snapshot schedule:

You might also be able to get these permissions with custom roles or other predefined roles.

Overview of creating snapshot schedules

When you create a snapshot schedule, you create a resource policy that you can apply to one or more Persistent Disk or Hyperdisk volumes.

You can create snapshot schedules in the following ways:

Using encryption with snapshot schedules

If a disk uses a customer-managed encryption key (CMEK), when you use a snapshot schedule to create snapshots of that disk, all the created snapshots are automatically encrypted with the same key.

You can't use snapshot schedules with disks that use a customer-supplied encryption key (CSEK).

Create a snapshot schedule

You can create a snapshot schedule for your disks using the Google Cloud console, Google Cloud CLI, or REST. You must create your snapshot schedule in the same region where your disk resides. For example, if your disk resides in zone us-west1-a, you must create the snapshot schedule in the us-west1 region. However, you can choose to store the snapshots generated by the snapshot schedule in a different location.

Note: If you use the gcloud CLI or the Google Cloud console, you must always set a retention policy when creating a snapshot schedule. If you make a request using REST, then you can omit this field and your snapshots will be retained indefinitely. Console
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances
    school The remaining steps will appear automatically in the Google Cloud console.

  2. Select the project that contains your VM instances.
  3. In the Name column, click the name of the VM that has the persistent disk to create a snapshot schedule for.
  4. In Storage , click the name of the Boot disk or the Additional disk to create a snapshot schedule for.
  5. Click editEdit. You might need to click the more_vert More actions menu and then editEdit.
  6. In Snapshot schedule, choose Create a schedule.
  7. In Name, enter one of the following names for the snapshot schedule:
  8. In the Location section, choose your snapshot storage location. The predefined or customized default location defined in your snapshot settings is automatically selected. Optionally, you can override the snapshot settings and store your snapshots in a custom storage location by doing the following:

    1. Choose the type of storage location that you want for your snapshot.

      • Choose Multi-regional for higher availability at a higher cost.
      • Choose Regional snapshots for more control over the physical location of your data at a lower cost.
    2. In the Select location field, select the specific region or multi-region that you want to use. To use the region or multi-region that is closest to your source disk, select Based on disk's location.

  9. To finish creating the snapshot schedule, click Create.
  10. To attach this snapshot schedule to the persistent disk, click Save.
gcloud

Replace the following:

Examples

In all the following examples:

Hourly schedule: In this example, the snapshot schedule starts at 22:00 UTC (14:00 PST) and occurs every 4 hours.

  gcloud compute resource-policies create snapshot-schedule hourly-schedule1 \
      --description "MY HOURLY SNAPSHOT SCHEDULE" \
      --max-retention-days 10 \
      --start-time 22:00 \
      --hourly-schedule 4 \
      --region us-west1 \
      --on-source-disk-delete keep-auto-snapshots \
      --snapshot-labels env=dev,media=images \
      --storage-location US

Daily schedule: In this example, the snapshot schedule starts at 22:00 UTC (14:00 PST) and occurs every day at the same time. The --daily-schedule flag must be present, but without an associated value.

gcloud compute resource-policies create snapshot-schedule daily-schedule2 \
    --description "MY DAILY SNAPSHOT SCHEDULE" \
    --max-retention-days 10 \
    --start-time 22:00 \
    --daily-schedule \
    --region us-west1 \
    --on-source-disk-delete keep-auto-snapshots \
    --snapshot-labels env=dev,media=images \
    --storage-location US

Weekly schedule: In this example, the snapshot schedule starts at 22:00 UTC (14:00 PST) and occurs every week on Tuesday.

gcloud compute resource-policies create snapshot-schedule weekly-schedule3 \
    --description "MY WEEKLY SNAPSHOT SCHEDULE" \
    --max-retention-days 10 \
    --start-time 22:00 \
    --weekly-schedule tuesday \
    --region us-west1 \
    --on-source-disk-delete keep-auto-snapshots \
    --snapshot-labels env=dev,media=images \
    --storage-location US
Go Java Node.js Python REST

Replace the following:

Similarly, you can create a weekly or monthly schedule. Review the resourcePolicies.insert method for details specific to setting a weekly or monthly schedule.

For example, the following request creates a weekly schedule that runs on Tuesday at 9:00 UTC.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/resourcePolicies

{
   "name": "SCHEDULE_NAME",
   "description": "SCHEDULE_DESCRIPTION",
   "snapshotSchedulePolicy": {
      "schedule": {
        "weeklySchedule": {
          "dayOfWeeks": [
          {
            "day": "Tuesday",
            "startTime": "9:00"
          }
          ]
        }
      },
      "retentionPolicy": {
          "maxRetentionDays": "5"
      },
      "snapshotProperties": {
          "guestFlush": "False",
          "labels": {
               "production": "webserver"
          },
          "storageLocations": "US"
      }
  }
}
Attach a snapshot schedule to a disk

After you create a schedule, attach it to an existing disk. Use the console, gcloud CLI, or the Compute Engine API.

Console

Attach a snapshot schedule to an existing disk.

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

    Go to Disks

  2. Select the name of the disk to which you want to attach a snapshot schedule. This opens the Manage disk page.

  3. On the Manage disk page, click editEdit. You might need to click the more_vertMore actions menu first.

  4. Use the Snapshot schedule drop-down menu to add the schedule to the disk. Or create a new schedule.

  5. If you created a new schedule, click Create.

  6. Click Save to complete the task.

gcloud

To attach a snapshot schedule to a disk, use the gcloud disks add-resource-policies command.

gcloud compute disks add-resource-policies DISK_NAME \
    --resource-policies SCHEDULE_NAME \
    --zone ZONE

Replace the following:

Go Java Python REST

Construct a POST request to disks.addResourcePolicies to attach a snapshot schedule to an existing disk.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME/addResourcePolicies

{
  "resourcePolicies": [
    "regions/REGION/resourcePolicies/SCHEDULE_NAME"
  ]
}

Replace the following:

Create a disk with a snapshot schedule

You can use the Google Cloud console or gcloud CLI to create a disk and a snapshot schedule at the same time.

Console
  1. In the Google Cloud console, go to the Disks page.

    Go to Disks

  2. Click Create Disk.

  3. Complete the required fields to create a zonal or regional disk.

  4. Create your disk in the same region as your snapshot schedule.

  5. Populate the fields for your Snapshot schedule.

  6. Use the drop-down menu and complete the fields to create the schedule.

  7. Click Create to create the schedule.

  8. Click Create to create the disk.

gcloud

Use the gcloud disks create command to create a zonal or regional Persistent Disk or Hyperdisk and attach a snapshot schedule to it.

gcloud compute disks create DISK_NAME \
     --resource-policies SCHEDULE_NAME \
     --zone ZONE

Replace the following:

Go Java What's next

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

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Snapshot schedules allow you to automatically and regularly back up your zonal and regional Persistent Disk and Google Cloud Hyperdisk volumes."],["You can create snapshot schedules that capture application data at the time of backup, known as application-consistent, guest-flush, or VSS snapshots, for both Linux and Windows systems."],["To use the code samples in a local development environment, you need to install and initialize the gcloud CLI and set up Application Default Credentials."],["You can create a snapshot schedule and attach it to an existing disk or create a new disk with an attached snapshot schedule."],["When creating a snapshot schedule, it must reside in the same region as the disk, and when using gcloud CLI or Google Cloud Console you must set a retention policy."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4