An automatic snapshot policy periodically creates snapshots of the disks that you specify. This protects your data against accidental loss caused by manual oversight and improves the reliability of your systems. You can also enable cross-region replication so that snapshot copies are stored in another region, keeping your data recoverable even during a regional outage.
Prerequisites
You have completed the required preparations Activate ECS Snapshot.
Make sure that a disk meets at least one of the following conditions:
The disk is attached to an ECS instance, and the instance is in the Running or Stopped state.
The disk is in the Unattached state and has been attached to an ECS instance before.
To check whether a disk has an attachment history, call DescribeDisks and review the value of the AttachedTime parameter.
Step 1: Configure the policy
If no snapshot policy exists in the current region, the system creates a default policy named default_policy the first time you apply a policy to a disk. You can use the default policy or create a custom policy based on your requirements.
In the top navigation bar, select the resource group and the region of the target resources.
On the Automatic Snapshot Policies tab, click Create Automatic Snapshot Policy.
On the Create Automatic Snapshot Policy panel, configure the policy.
Policy information
Parameter
Description
Policy Name
Enter a custom name for the policy.
Execution Frequency
Select one or more days from Monday to Sunday on which snapshots are created.
Execution Time
Select the time at which snapshots are created, in UTC+8 and in hours.
The snapshot is created within one hour after the selected Execution Time.
To create multiple snapshots per day, select multiple hourly points from 00:00 to 23:00 (24 points in total).
ImportantCreating a snapshot may cause a one-time, millisecond-level fluctuation in disk I/O performance. To minimize the impact on your workloads, avoid peak business hours.
Retention Period
Set how long snapshots are kept. Snapshots are retained permanently by default, or you can customize the retention period.
Custom Period: Snapshots are automatically deleted after the retention period expires.
Retain continuously until the number of snapshots reaches the quota limit (up to 2000 automatic snapshots per disk), after which they will be automatically deleted: When the number of automatic snapshots reaches the upper limit, the earliest automatic snapshot that is not locked is automatically deleted.
NoteWhen a snapshot has three days of retention remaining, the Retention Period column in the snapshot list highlights a notice that shows the number of days until automatic deletion. You can extend snapshot retention period as needed.
For the automatic snapshot quota, see Limits.
After you create the policy, you can modify policy adjust the retention period later. Changes to the retention period do not affect existing snapshots and apply only to newly created automatic snapshots.
If enable automatic snapshots to be released with the disk is enabled, releasing the disk (by manually releasing the disk, releasing the disk together with the instance, or replacing the system disk) also deletes automatic snapshots that have not yet expired.
Whether snapshots use a custom or permanent retention period, you can delete snapshots as needed to avoid ongoing storage costs.
Cross-region replication (optional)
ImportantWhen you enable replication, snapshot copies are generated in the destination region. This incurs cross-region traffic fees, and the copies in the destination region are billed for snapshot storage based on capacity and storage duration. For more information, see Snapshot billing.
Parameter
Description
Cross-region Snapshot Replication
After you enable this option, snapshots created by the policy are automatically replicated to the destination region for off-site backup and disaster recovery.
Target Region
The region to which snapshots are replicated.
Copied Snapshot Retention Period
How long the new snapshot copies are kept in the destination region.
Encrypted Copy
Disabled: If the source snapshot is encrypted, the copy is encrypted in the destination region by using a service key created by Key Management Service (KMS). If the source snapshot is not encrypted, it is copied directly.
Enabled: The copy is encrypted in the destination region by using the specified key, regardless of whether the source snapshot is encrypted. For information about keys, see Disk encryption.
Advanced settings (optional)
Parameter
Description
Tags
Select or enter a tag key-value pair. Automatic snapshots created by the policy are bound to this tag by default. You can modify.
Resource Group
Select resource groups to manage policies in groups.
Step 2: Associate resources
On the Associate Resources page, select an Association Type.
Currently, associating instance tags is supported for only some customers. If you need this feature, submit a ticket to request access.
You cannot change the association type after you create it. A policy supports only one association type, so choose carefully based on your requirements.
Associate Disk: Bind specific target disks. You can add or remove disks at any time. This option suits scenarios where the set of disks is fixed and requires precise control.
Associate Instance Tag: Each time an automatic snapshot is created, the policy identifies the associated instances by tag and creates snapshots for all disks attached to those instances.
Associate disks
Association Type, set to Associate Disk.
On the Optional Disks list, select the target disks and move them to the Selected disks list.
Click Confirm.
Ultra disks, standard SSDs, and basic disks do not support concurrent snapshot creation. If a disk of one of these types is associated with multiple automatic snapshot policies at the same time, some automatic snapshots may be skipped.
After the policy is created, you can add or remove the disks associated with the policy by applying the automatic snapshot policy to disks.
Associate instance tags
Association Type, set to Associate Instance Tag.
On the Associate Instance Tag section, add the tags of the instances that you want to associate, and click Confirm.
Click View Associated Instances to go to the instance list and view the matched instances.
ImportantMultiple tags use an AND relationship: an instance must match all tags to be selected. Only custom tags are supported; system tags are not. A policy can be associated with a minimum of 1 tag and a maximum of 5 tags.
After a disk is detached from an instance, an instance is unbound from a tag, or a tag is removed from the policy, snapshots are no longer created for the matched disks starting from the next automatic snapshot creation time.
Ultra disks, standard SSDs, and basic disks do not support concurrent snapshot creation. If a disk of one of these types is associated with multiple automatic snapshot policies at the same time, some automatic snapshots may be skipped.
After you create the policy, you can set an automatic snapshot policy for an instance to modify the associated instance tags.
Related information
You can perform the following operations by calling API operations:
Apply or cancel an automatic snapshot policy for an existing disk