[Yandex Cloud documentation](../../../index.md) > [Yandex Compute Cloud](../../index.md) > [Step-by-step guides](../index.md) > Disk snapshots > Changing a snapshot schedule

# Updating a disk snapshot schedule


## Updating basic settings {#update-basic-parameters}

To update basic settings of a [disk snapshot](../../concepts/snapshot.md) [schedule](../../concepts/snapshot-schedule.md):

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) containing the schedule.
  1. Navigate to **Compute Cloud**.
  1. In the left-hand panel, select ![image](../../../_assets/console-icons/picture.svg) **Snapshots**.
  1. Navigate to the **Snapshot schedules** tab.
  1. Next to the schedule you want to update, click ![image](../../../_assets/console-icons/ellipsis.svg) and select **Edit**.
  1. Under **Launch schedule**:
     * Specify the schedule settings:
     
         * `Daily`: Specify the frequency and start time.
         * `By day of week`: Specify the days and start time.
         * `By month`: Specify the frequency or months and start time.
         * `Cron`: Specify a [cron expression](../../concepts/snapshot-schedule.md#cron).
     
     * In the **Start date** field, set the start date for your schedule.
  1. Under **Storage settings**, select the snapshot storage policy:
     * **Store all snapshots**: Enable to retain all snapshots created by this schedule.
     * **Only the last**: Specify the number of the latest snapshots to retain or the number of days for which to retain the snapshots. Any other snapshots created by this schedule will be deleted automatically.
     
     {% note info %}
     
     There are [quotas](../../concepts/limits.md#compute-quotas) on the number and total size of snapshots in the cloud.
     
     {% endnote %}
  1. Optionally, under **General information**:
     * Enter a name for your schedule in the following format:
     
         * Length: between 3 and 63 characters.
         * It can only contain lowercase Latin letters, numbers, and hyphens.
         * It must start with a letter and cannot end with a hyphen.
     
     * Enter a schedule description.
     * Add schedule [labels](../../../overview/concepts/services.md#labels).
  1. Optionally, under **Snapshot settings** for snapshots that will be created according to this schedule:
     * Provide a description.
     * Add labels.
  1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the [CLI](../../../cli/index.md) commands for managing schedules:

     ```bash
     yc compute snapshot-schedule --help
     yc compute snapshot-schedule update --help
     ```

  1. Get a list of schedules in the default [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder):

     ```bash
     yc compute snapshot-schedule list --format yaml
     ```

     Result:

     ```text
     - id: fc852cvb1ipd5********
       folder_id: e1ea8s8l71li********
       created_at: "2022-09-28T13:25:02Z"
     ...
         expression: 10 19 ? * *
       snapshot_count: "7"
       snapshot_spec: {}
     ```

  1. Update the parameters of the selected schedule:

     ```bash
     yc compute snapshot-schedule update <schedule_name_or_ID> \
       --expression "<cron_expression>" \
       --new-name "<new_name_for_schedule>"
      ```

     Where:
     * `--expression`: [Cron expression](../../concepts/snapshot-schedule.md#cron). This is a required setting.
     * `--new-name`: New name for the schedule.

     For more information about the `yc compute snapshot-schedule update` command, see the [CLI reference](../../../cli/cli-ref/compute/cli-ref/snapshot-schedule/update.md).

     Result:

     ```text
     id: fd8uhc5qcinv********
     folder_id: b1g681qpemb4********
     created_at: "2026-05-25T21:03:22Z"
     name: my-schedule
     status: ACTIVE
     schedule_policy:
       start_at: "2027-01-02T15:04:05Z"
       expression: 10 19 ? * *
     retention_period: 3600s
     ```

- Terraform {#tf}

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  1. Open the Terraform configuration file and edit the section specifying the schedule:

     {% cut "Example of specifying a schedule in Terraform configuration" %}

     ```hcl
     resource "yandex_compute_snapshot_schedule" "default" {
       schedule_policy {
         expression = "10 19 ? * *"
       }

       name     = "my-name"
       disk_ids = ["epdqo0pr4ath********", "epdr5lb64ra1********"]
     }
     ```

     {% endcut %}

  1. Apply the changes:

     1. In the terminal, navigate to the configuration file directory.
     1. Make sure the configuration is correct using this command:
     
        ```bash
        terraform validate
        ```
     
        If the configuration is valid, you will get this message:
     
        ```bash
        Success! The configuration is valid.
        ```
     
     1. Run this command:
     
        ```bash
        terraform plan
        ```
     
        You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
     1. Apply the configuration changes:
     
        ```bash
        terraform apply
        ```
     
     1. Type `yes` and press **Enter** to confirm the changes.

  You can check the schedule update and settings using the [management console](https://console.yandex.cloud) or this [CLI](../../../cli/index.md) command:

  ```bash
  yc compute snapshot-schedule get <schedule_name_or_ID>
  ```

- API {#api}

  1. Get a list of schedules using the [list](../../api-ref/SnapshotSchedule/list.md) REST API method for the [SnapshotSchedule](../../api-ref/SnapshotSchedule/index.md) resource or the [SnapshotScheduleService/List](../../api-ref/grpc/SnapshotSchedule/list.md) gRPC API call.

     You can create snapshots of network [disks](../../concepts/disk.md#disks_types) and drives, such as HDDs, SSDs, and non-replicated SSDs, as well as ultra high-speed network storages with three replicas (SSD).
     
     For non-replicated SSDs and ultra high-speed network storages with three replicas (SSD), the snapshot time is not determined.
     
     To create snapshots of local disks residing on [dedicated hosts](../../concepts/dedicated-host.md), use [Yandex Cloud Backup](../../../backup/index.md). This service supports Ubuntu, CentOS, CentOS Stream, and Windows Server.

  1. Update a [disk](../../concepts/disk.md) snapshot schedule using the [update](../../api-ref/SnapshotSchedule/update.md) REST API method for the `SnapshotSchedule` resource or the [SnapshotScheduleService/Update](../../api-ref/grpc/SnapshotSchedule/update.md) gRPC API call.

{% endlist %}

## Updating a disk list {#update-disk-list}

To edit a list of disks for which snapshots are scheduled:

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder containing the schedule.
  1. Navigate to **Compute Cloud**.
  1. In the left-hand panel, select ![image](../../../_assets/console-icons/picture.svg) **Snapshots**.
  1. On the **Snapshot schedules** tab, select the schedule for which you want to update a disk list.
  1. Update the disk list:
     * To add a new disk, under **Disks**, click ![image](../../../_assets/console-icons/plus.svg) **Add disk**. In the window that opens, choose a disk to add to the schedule and click **Save**.

       You can create snapshots of network [disks](../../concepts/disk.md#disks_types) and drives, such as HDDs, SSDs, and non-replicated SSDs, as well as ultra high-speed network storages with three replicas (SSD).
       
       For non-replicated SSDs and ultra high-speed network storages with three replicas (SSD), the snapshot time is not determined.
       
       To create snapshots of local disks residing on [dedicated hosts](../../concepts/dedicated-host.md), use [Yandex Cloud Backup](../../../backup/index.md). This service supports Ubuntu, CentOS, CentOS Stream, and Windows Server.

     * To remove a disk, under **Disks**, next to the disk you want to remove from the schedule, click ![image](../../../_assets/console-icons/ellipsis.svg) and select **Delete from schedule**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  Add or [remove](#remove) disks using the `add-disks` and `remove-disks` commands.

  To add disks:
  1. See the description of the CLI commands for managing schedules:

     ```bash
     yc compute snapshot-schedule --help
     yc compute snapshot-schedule add-disks --help
     ```

  1. Get a list of schedules in the default folder:

     ```bash
     yc compute snapshot-schedule list --format yaml
     ```

     Result:

     ```text
     - id: fc852cvb1ipd5********
       folder_id: e1ea8s8l71li********
       created_at: "2022-09-28T13:25:02Z"
     ...
         expression: 10 19 ? * *
       snapshot_count: "7"
       snapshot_spec: {}
     ```

  1. Get disk IDs to add them to the schedule:

     ```bash
     yc compute disk list --format yaml
     ```

     Result:

     ```text
     - id: epdcq9g3co9s********
       folder_id: e1ea8s8l71li********
       created_at: "2022-10-13T14:37:44Z"
     ...
       instance_ids:
         - fhm1c7u23aiq********
       disk_placement_policy: {}
     ```

  1. Add disks to the schedule:

     ```bash
     yc compute snapshot-schedule add-disks <schedule_name_or_ID> \
       --disk-id <disk_1_ID>,<disk_2_ID>
     ```

     Result:

     ```text
     done (3s)
     id: fc8e52mvchb2********
     folder_id: e1ea8s8l71li********
     ...
       expression: 36 14 */1 * *
     snapshot_count: "3"
     snapshot_spec: {}
     ```

  To remove disks: {#remove}
  1. See the description of the CLI commands for managing schedules:

     ```bash
     yc compute snapshot-schedule --help
     yc compute snapshot-schedule remove-disks --help
     ```

  1. Get a list of schedules in the default folder:

     ```bash
     yc compute snapshot-schedule list --format yaml
     ```

     Result:

     ```text
     - id: fc852cvb1ipd5********
       folder_id: e1ea8s8l71li********
       created_at: "2022-09-28T13:25:02Z"
     ...
         expression: 10 19 ? * *
       snapshot_count: "7"
       snapshot_spec: {}
     ```

  1. Get a list of disks in the current schedule:

     ```bash
     yc compute snapshot-schedule list-disks <schedule_name_or_ID> \
       --format yaml
     ```

     Result:

     ```text
     - id: epdcq9g3co9s********
       folder_id: e1ea8s8l71li********
       created_at: "2022-10-13T14:37:44Z"
     ...
       instance_ids:
         - fhm1c7u23aiq********
       disk_placement_policy: {}
     ```

  1. Remove disks from the schedule:

     ```bash
     yc compute snapshot-schedule remove-disks <schedule_name_or_ID> \
       --disk-id <disk_1_ID>,<disk_2_ID>
     ```

     Result:

     ```text
     done (3s)
     id: fc8e52mvchb2********
     folder_id: e1ea8s8l71li********
     ...
       expression: 36 14 */1 * *
     snapshot_count: "3"
     snapshot_spec: {}
     ```

- Terraform {#tf}

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  1. Open the Terraform configuration file and edit the disk list specified in the `disk_ids` parameter:

     {% cut "Example of specifying a schedule in Terraform configuration" %}

     ```hcl
     resource "yandex_compute_snapshot_schedule" "default" {
       schedule_policy {
         expression = "10 19 ? * *"
       }

       name     = "my-name"
       disk_ids = ["epdqo0pr4ath********", "epdr5lb64ra1********"]
     }
     ```

     {% endcut %}

  1. Apply the changes:

     1. In the terminal, navigate to the configuration file directory.
     1. Make sure the configuration is correct using this command:
     
        ```bash
        terraform validate
        ```
     
        If the configuration is valid, you will get this message:
     
        ```bash
        Success! The configuration is valid.
        ```
     
     1. Run this command:
     
        ```bash
        terraform plan
        ```
     
        You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
     1. Apply the configuration changes:
     
        ```bash
        terraform apply
        ```
     
     1. Type `yes` and press **Enter** to confirm the changes.

  You can check the schedule update and settings using the [management console](https://console.yandex.cloud) or this [CLI](../../../cli/index.md) command:

  ```bash
  yc compute snapshot-schedule get <schedule_name_or_ID>
  ```

- API {#api}

  1. Get a list of schedules using the [list](../../api-ref/SnapshotSchedule/list.md) REST API method for the [SnapshotSchedule](../../api-ref/SnapshotSchedule/index.md) resource or the [SnapshotScheduleService/List](../../api-ref/grpc/SnapshotSchedule/list.md) gRPC API call.
  1. Get a list of disks using the [list](../../api-ref/Disk/list.md) REST API method for the [Disk](../../api-ref/Disk/index.md) resource or the [DiskService/List](../../api-ref/grpc/Disk/list.md) gRPC API call.
  1. Update the list of disks in a schedule using the [updateDisks](../../api-ref/SnapshotSchedule/updateDisks.md) REST API method for the `SnapshotSchedule` resource or the [SnapshotScheduleService/UpdateDisks](../../api-ref/grpc/SnapshotSchedule/updateDisks.md) gRPC API call.

{% endlist %}

## Examples {#examples}

### Updating the name of a schedule {#change-name}

{% list tabs group=instructions %}

- CLI {#cli}

  1. Get a list of schedules in the default folder:

     ```bash
     yc compute snapshot-schedule list --format yaml
     ```

     Result:

     ```text
     - id: fc852cvb1ipd5********
       folder_id: e1ea8s8l71li********
       created_at: "2022-09-28T13:25:02Z"
     ...
         expression: 10 19 ? * *
       snapshot_count: "7"
       snapshot_spec: {}
     ```

  1. Update the name of the selected schedule:

     ```bash
     yc compute snapshot-schedule update sched-1 \
       --new-name "my-schedule"
     ```

     Result:

     ```text
     done (3s)
     id: fc8e52mvchb2********
     folder_id: e1ea8s8l71li********
     ...
       expression: 36 14 */1 * *
     snapshot_count: "3"
     snapshot_spec: {}
     ```

{% endlist %}

#### What's next {#what-is-next}

* [Disabling and enabling a disk snapshot schedule](stop-and-start-schedule.md).
* [Deleting a disk snapshot schedule](delete-schedule.md).