All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::AutoSnapshotPolicy

Last Updated:Apr 09, 2025

ALIYUN::ECS::AutoSnapshotPolicy is used to create an automatic snapshot policy.

Syntax

{
  "Type" : "ALIYUN::ECS::AutoSnapshotPolicy",
  "Properties" : {
    "TimePoints" : String,
    "RepeatWeekdays" : String,
    "RetentionDays" : Integer,
    "DiskIds" : List,
    "Tags": List,
    "AutoSnapshotPolicyName" : String,
    "ResourceGroupId": String
    "CopyEncryptionConfiguration": Map,
    "EnableCrossRegionCopy": Boolean,
    "CopiedSnapshotsRetentionDays": Integer,
    "TargetCopyRegions": List
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

TimePoints

List

Yes

Yes

The points in time of a day at which to create automatic snapshots.

Valid values: 0 to 23. The values from 0 to 23 indicate the 24 hours of a day from 00:00 to 23:00. For example, 1 indicates 01:00.

Unit: hour.

To schedule multiple automatic snapshots to be created in a day, you can specify multiple time points. Multiple time points must be specified as a list and separated by commas (,). Example: [0, 1, ... 23]. You can specify up to 24 time points.

RepeatWeekdays

List

Yes

Yes

The days of a week on which to create automatic snapshots.

Valid values: 1 to 7. The values from 1 to 7 indicate the seven days in a week from Monday to Sunday.

Cycle: week.

To schedule multiple automatic snapshots to be created in a week, you can specify multiple days. Multiple days must be specified as a list and separated by commas (,). Example: [1, 2, ... 7]. You can specify up to seven days.

RetentionDays

Integer

Yes

Yes

The retention period of automatic snapshots.

Valid values:

  • -1 (default): Automatic snapshots are permanently retained.

  • 1 to 65535: Automatic snapshots are retained for the specified number of days.

Unit: day.

DiskIds

List

No

Yes

The IDs of disks to which you want to apply the automatic snapshot policy.

To apply the automatic snapshot policy to multiple disks, you must specify multiple disk IDs as a list in the ["d-xxxxxxxxx", "d-yyyyyyyyy", … "d-zzzzzzzzz"] format. Separate multiple IDs with commas (,).

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

Tags

List

No

Yes

The tags.

You can add up to 20 tags.

For more information, see Tags properties.

AutoSnapshotPolicyName

String

No

Yes

The name of the automatic snapshot policy.

The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

This property is empty by default.

CopyEncryptionConfiguration

Map

No

No

The encryption configurations of cross-region snapshot replication.

For more information, see the "CopyEncryptionConfiguration properties" section of this topic.

EnableCrossRegionCopy

Boolean

No

No

Specifies whether to enable cross-region snapshot replication.

Valid values:

  • true

  • false

CopiedSnapshotsRetentionDays

Integer

No

No

The retention period of the snapshot copy in the destination region.

Unit: day. Valid values:

  • -1: The snapshot copy is permanently retained.

  • 1 to 65535: The snapshot copy is retained for the specified number of days.

Default value: -1.

TargetCopyRegions

List

No

No

The destination region of cross-region snapshot replication.

You can specify only one destination region.

Tags syntax

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The key of the tag.

The key must be 1 to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The value of the tag.

The value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

CopyEncryptionConfiguration syntax

"CopyEncryptionConfiguration": 
  {
    "KMSKeyId": String,
    "Encrypted": Boolean
  } 

CopyEncryptionConfiguration properties

Property

Type

Required

Editable

Description

Constraint

KMSKeyId

String

No

No

The ID of the Key Management Service (KMS) key used in cross-region snapshot replication and encryption.

None.

Encrypted

Boolean

No

No

Specifies whether to enable cross-region snapshot replication and encryption.

Valid values:

  • true

  • false

Default value: false.

Return values

Fn::GetAtt

  • AutoSnapshotPolicyId: the ID of the automatic snapshot policy.

  • Arn: the Alibaba Cloud Resource Name (ARN).

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DiskIds:
    Type: CommaDelimitedList
    AssociationProperty: ALIYUN::ECS::Disk::DiskId
    Description: The disk ID. When you want to apply the automatic snapshot policy to multiple disks, you can set the DiskIds to an array. The format is list of ["d-xxxxxxxxx", "d-yyyyyyyyy", ..., "d-zzzzzzzzz"] and the IDs are separated by commas (,).
Resources:
  AutoSnapshotPolicy:
    Type: ALIYUN::ECS::AutoSnapshotPolicy
    Properties:
      TimePoints:
        - 20
        - 23
      DiskIds:
        Ref: DiskIds
      RetentionDays: 1
      RepeatWeekdays:
        - 1
        - 2
Outputs:
  AutoSnapshotPolicyId:
    Description: The automatic snapshot policy ID.
    Value:
      Fn::GetAtt:
        - AutoSnapshotPolicy
        - AutoSnapshotPolicyId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DiskIds": {
      "Type": "CommaDelimitedList",
      "AssociationProperty": "ALIYUN::ECS::Disk::DiskId",
      "Description": "The disk ID. When you want to apply the automatic snapshot policy to multiple disks, you can set the DiskIds to an array. The format is list of [\"d-xxxxxxxxx\", \"d-yyyyyyyyy\", ..., \"d-zzzzzzzzz\"] and the IDs are separated by commas (,)."
    }
  },
  "Resources": {
    "AutoSnapshotPolicy": {
      "Type": "ALIYUN::ECS::AutoSnapshotPolicy",
      "Properties": {
        "TimePoints": [
          20,
          23
        ],
        "DiskIds": {
          "Ref": "DiskIds"
        },
        "RetentionDays": 1,
        "RepeatWeekdays": [
          1,
          2
        ]
      }
    }
  },
  "Outputs": {
    "AutoSnapshotPolicyId": {
      "Description": "The automatic snapshot policy ID.",
      "Value": {
        "Fn::GetAtt": [
          "AutoSnapshotPolicy",
          "AutoSnapshotPolicyId"
        ]
      }
    }
  }
}

For more examples, visit auto-snapshot-policy.yml.