Template name
ACS-ECS-ScheduleToBulkyCreateSnapshot Scheduled batch snapshot creation
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 schedule for the task |
Json |
Yes |
||
|
diskIds |
The IDs of the disks to create snapshots for. |
List |
Yes |
||
|
regionId |
The region ID. |
String |
No |
{{ ACS::RegionId }} |
|
|
retentionDays |
The retention period of the snapshots. |
Number |
No |
0 |
|
|
tags |
The tags to add to the snapshots. |
Json |
No |
[] |
|
|
rateControl |
The rate control settings for concurrent execution. |
Json |
No |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
The RAM role assumed by 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"
}
]
}
Details
For more information, see ACS-ECS-ScheduleToBulkyCreateSnapshot.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Schedules the batch creation of snapshots.
name-en: ACS-ECS-ScheduleToBulkyCreateSnapshot
Parameters:
regionId:
Label:
en: Region ID
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
timerTrigger:
Type: Json
Label:
en: Schedule
AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
AssociationPropertyMetadata:
MinuteInterval: 30
diskIds:
Label:
en: Disk IDs
AssociationProperty: ALIYUN::ECS::Disk::DiskId
AssociationPropertyMetadata:
RegionId: regionId
Type: List
retentionDays:
Label:
en: Retention Period (Days)
Description:
en: The retention period of the snapshots, in days. After the retention period expires, the snapshots are automatically released. A value of 0 indicates that the snapshots are not automatically released.
Type: Number
MaxValue: 65536
MinValue: 0
Default: 0
tags:
Label:
en: Snapshot Tags
Type: Json
AssociationProperty: Tags
AssociationPropertyMetadata:
ShowSystem: false
Default: []
rateControl:
Label:
en: Concurrency Control
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: RAM Role for OOS
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers the task on a schedule.
Properties:
Type:
Fn::Select:
- type
- '{{timerTrigger}}'
Expression:
Fn::Select:
- expression
- '{{timerTrigger}}'
StartDate:
Fn::Select:
- startDate
- '{{ timerTrigger }}'
EndDate:
Fn::Select:
- endDate
- '{{ timerTrigger }}'
TimeZone:
Fn::Select:
- timeZone
- '{{ timerTrigger }}'
- Name: createSnapshot
Action: ACS::ECS::CreateSnapshot
Description:
en: Creates a snapshot for a disk.
Properties:
regionId: '{{ regionId }}'
diskId: '{{ ACS::TaskLoopItem }}'
retentionDays:
Fn::If:
- Fn::Equals:
- '{{ retentionDays }}'
- 0
- ''
- '{{ retentionDays }}'
tags: '{{ tags }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ diskIds }}'
Outputs:
snapshotIds:
AggregateType: Fn::ListJoin
AggregateField: snapshotId
Outputs:
createdSnapshotIds:
Type: List
Value: '{{ createSnapshot.snapshotIds }}'