ALIYUN::ECS::AutoSnapshotPolicy

更新时间:2025-03-24 02:02:19

ALIYUN::ECS::AutoSnapshotPolicy类型用于创建自动快照策略。

语法

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

属性

属性名称

类型

必须

允许更新

描述

约束

属性名称

类型

必须

允许更新

描述

约束

TimePoints

List

自动快照的创建时间点。

取值范围:0~23。表示00:0023:0024个时间点,例如:1表示01:00。

单位:小时。

当一天内需要创建多次自动快照时,可以传入多个时间点:

  • 最多传入24个时间点。

  • 多个时间点用格式为[0, 1, … 23]的列表表示,时间点之间用半角逗号(,)隔开。

RepeatWeekdays

List

自动快照的重复日期。

取值:1~7,依次表示周一至周日。

周期:星期。

如果一星期内需要创建多次自动快照时,可设置多个时间点,多个时间点用[1, 2, … 7]的列表表示,多个时间点之间用半角逗号(,)隔开。最多设置7个时间点。

RetentionDays

Integer

自动快照的保留时间。

取值范围:

  • -1(默认值):永久保存。

  • 1~65,535:指定保存天数。

单位:天。

DiskIds

List

目标磁盘ID。

当您需要将自动快照策略应用于多块磁盘时,多块磁盘ID用["d-xxxxxxxxx", "d-yyyyyyyyy", … "d-zzzzzzzzz"]的列表表示,磁盘ID之间用半角逗号(,)隔开。

ResourceGroupId

String

快照所属的资源组ID。

Tags

List

标签。

最多支持添加20个标签。

更多信息,请参见Tags属性

AutoSnapshotPolicyName

String

自动快照策略的名称。

长度为2~128个字符。必须以英文字母或汉字开头,不能以http://https://开头。可包含英文字母、汉字、数字、半角冒号(:)、下划线(_)或短划线(-)。

默认值:空。

CopyEncryptionConfiguration

Map

快照异地备份加密参数对象。

更多信息,请参见CopyEncryptionConfiguration属性。

EnableCrossRegionCopy

Boolean

是否允许自动跨地域复制。

取值:

  • true:允许。

  • false:不允许。

CopiedSnapshotsRetentionDays

Integer

跨地域复制快照的保留时间。

单位为天。取值范围:

  • -1:永久保存

  • 1~65535:指定保存天数

默认值:-1。

TargetCopyRegions

List

跨地域复制快照的目标地域。

目前支持设置一个目标地域。

Tags语法

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

Tags属性

属性名称

类型

必须

允许更新

描述

约束

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

长度为1~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

Value

String

标签值。

长度为0~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

CopyEncryptionConfiguration语法

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

CopyEncryptionConfiguration属性

属性名称

类型

必须

允许更新

描述

约束

属性名称

类型

必须

允许更新

描述

约束

KMSKeyId

String

快照异地加密备份使用的 KMS 密钥 ID。

Encrypted

Boolean

是否开启快照异地加密备份。

取值范围:

  • true:是。

  • false:否。

默认值:false。

返回值

Fn::GetAtt

  • AutoSnapshotPolicyId:自动快照策略ID。

  • Arn:阿里云资源名称。

示例

YAML
JSON
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"
        ]
      }
    }
  }
}

更多示例,请参见:YAML示例

  • 本页导读 (1)
  • 语法
  • 属性
  • Tags语法
  • Tags属性
  • CopyEncryptionConfiguration语法
  • CopyEncryptionConfiguration属性
  • 返回值
  • 示例