全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::ECS::AutoSnapshotPolicy

更新時間:Mar 25, 2025

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:00至23:00共24個時間點,例如: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 金鑰識別碼。

Encrypted

Boolean

是否開啟快照異地加密備份。

取值範圍:

  • true:是。

  • false:否。

預設值:false。

傳回值

Fn::GetAtt

  • AutoSnapshotPolicyId:自動快照策略ID。

  • Arn:阿里雲資源名稱。

樣本

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樣本