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
  }
}

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 points in time on the hour from 00:00 to 23:00. For example, 1 indicates 01:00.

Unit: hours.

If you need automatic snapshots to be created at several times in a day, you can specify multiple hours.

  • You can specify up to 24 hours.
  • You must set this property to a list. Example: [0, 1, ... 23]. Separate multiple hours with commas (,).
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.

If you need automatic snapshots to be created at several times in a week, you can specify multiple days. You must set this property to a list. Example: [1, 2, ... 7]. Separate multiple days with commas (,). You can specify up to seven days.

RetentionDays Integer Yes Yes The number of days for which the system retains automatic snapshots.

Default value: -1. Valid values:

  • -1: permanently retains automatic snapshots.
  • 1 to 65535: retains automatic snapshots based on the number of days that you specify.

Unit: days.

DiskIds List No Yes

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

If you need to apply the automatic snapshot policy to multiple disks, you must set this property to 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 to which the automatic snapshot policy belongs. None
Tags List No Yes The tags of the automatic snapshot policy. 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, and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.

By default, this property is empty.

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 tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. The tag key cannot start with aliyun or acs:.
Value String No No The value of the tag. The tag value can be up to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

Return value

Fn::GetAtt

AutoSnapshotPolicyId: the ID of the automatic snapshot policy.

Examples

  • YAMLformat

    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
  • JSONformat

    {
      "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 AutoSnapshotPolicy.json and AutoSnapshotPolicy.yml.