All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-ScheduleToBulkyCreateSnapshot

Last Updated:Nov 25, 2024

Template name

ACS-ECS-ScheduleToBulkyCreateSnapshot

Execute Now

Template description

Creates snapshots for multiple disks at a time as scheduled.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

timerTrigger

The type of the scheduled task

Json

Yes

diskIds

The ID of the disk in which you want to clear data.

List

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

retentionDays

The retention period of the snapshot.

Number

No

0

tags

The tags of the snapshot.

Json

No

[]

rateControl

The rate control settings.

Json

No

{'Mode': 'Concurrency', 'MaxErrors': '0', 'Concurrency': 10}

OOSAssumeRole

The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS).

String

No

OOSServiceRole

Output parameters

Parameter

Description

Type

createdSnapshotIds

List

Permission policy that is required to execute the template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateSnapshot",
                "ecs:DescribeDisks",
                "ecs:DescribeInstances",
                "ecs:DescribeSnapshots"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

References

For more information, see ACS-ECS-ScheduleToBulkyCreateSnapshot.yml at GitHub.

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Schedule bulky create snapshot
  zh-cn: the description in Chinese
  name-en: ACS-ECS-ScheduleToBulkyCreateSnapshot
  name-zh-cn: the description in Chinese
Parameters:
  regionId:
    Label:
      en: RegionId
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  timerTrigger:
    Type: Json
    Label:
      en: TimerTrigger
      zh-cn: the description in Chinese
    AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
    AssociationPropertyMetadata:
      MinuteInterval: 30
  diskIds:
    Label:
      en: DiskIds
      zh-cn: the description in Chinese
    AssociationProperty: ALIYUN::ECS::Disk::DiskId
    AssociationPropertyMetadata:
      RegionId: regionId
    Type: List
  retentionDays:
    Label:
      en: RetentionDays
      zh-cn: the description in Chinese
    Description:
      en: The unit is day. Snapshots are automatically released after the retention time expires.The default is 0, indicating that the snapshot will not be automatically released.
      zh-cn: the description in Chinese  
    Type: Number
    MaxValue: 65536
    MinValue: 0
    Default: 0
  tags:
    Label:
      en: Tags
      zh-cn: the description in Chinese
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
    Default: []
  rateControl:
    Label:
      en: RateControl
      zh-cn: the description in Chinese
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: the description in Chinese
    Type: String
    Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: timerTrigger
    Action: ACS::TimerTrigger
    Description:
      en: Triggers a task as scheduled by specifying type and expression
      zh-cn: the description in Chinese
    Properties:
      Type:
        Fn::Select:
          - type
          - '{{timerTrigger}}'
      Expression:
        Fn::Select:
          - expression
          - '{{timerTrigger}}'
      EndDate:
        Fn::Select:
          - endDate
          - '{{ timerTrigger }}'
      TimeZone:
        Fn::Select:
          - timeZone
          - '{{ timerTrigger }}'
  - Name: createSnapshot
    Action: ACS::ECS::CreateSnapshot
    Description:
      en: Create a snapshot for a cloud disk
      zh-cn: the description in Chinese
    Properties:
      regionId: '{{ regionId }}'
      diskId: '{{ ACS::TaskLoopItem }}'
      retentionDays:
        Fn::If:
          - Fn::Equals:
              - '{{ retentionDays }}'
              - 0
          - ''
          - '{{ retentionDays }}'
      tags: '{{ tags }}'
    Outputs:
      snapshotId:
        Type: String
        ValueSelector: .snapshotId
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ diskIds }}'
      Outputs:
        snapshotIds:
          AggregateType: Fn::ListJoin
          AggregateField: snapshotId
Outputs:
  createdSnapshotIds:
    Type: List
    Value: '{{ createSnapshot.snapshotIds }}'