Template name
ACS-ECS-BulkyDeleteSnapshot
Template description
Deletes multiple snapshots at a time.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
snapshotType | The snapshot type. | String | No | Specified | |
snapshotIds | The IDs of snapshots to be deleted. | List | No | [] | |
force | Specifies whether to forcibly delete the snapshots that have been used to create disks. | Boolean | No | False | |
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 | "" |
Output parameters
None
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:CancelAutoSnapshotPolicy",
"ecs:DeleteImage",
"ecs:DeleteSnapshot",
"ecs:DeleteSnapshotGroup",
"ecs:DescribeAutoSnapshotPolicyEx",
"ecs:DescribeDisks",
"ecs:DescribeImageSharePermission",
"ecs:DescribeImages",
"ecs:DescribeRegions",
"ecs:DescribeSnapshotGroups",
"ecs:DescribeSnapshots",
"ecs:ModifyImageSharePermission"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"resourcesharing:DisassociateResourceShare",
"resourcesharing:ListSharedResources"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
References
For more information, see ACS-ECS-BulkyDeleteSnapshot.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Bulky delete snapshot
zh-cn: the description in Chinese
name-en: ACS-ECS-BulkyDeleteSnapshot
name-zh-cn: the description in Chinese
categories:
- data_backup
Parameters:
snapshotType:
Label:
en: SnapshotType
zh-cn: the description in Chinese
Description:
en: Specified: Specified snapshot. Unrelated: Unrelated snapshot
zh-cn: the description in Chinese
Type: String
Default: Specified
AllowedValues:
- Specified
- Unrelated
snapshotIds:
Label:
en: SnapshotIds
zh-cn: the description in Chinese
Type: List
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${snapshotType}
- Specified
Default: []
force:
Label:
en: Force
zh-cn: the description in Chinese
Type: Boolean
Default: false
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: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: deleteSnapshot
Action: ACS::ExecuteAPI
When:
Fn::Equals:
- '{{ snapshotType }}'
- Specified
Description:
en: Delete the specified snapshot
zh-cn: the description in Chinese
Properties:
Service: ECS
API: DeleteSnapshot
Parameters:
Force: '{{ force }}'
SnapshotId: '{{ ACS::TaskLoopItem }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ snapshotIds }}'
- Name: deleteUnrelatedSnapshot
Action: ACS::ECS::DeleteUnrelatedSnapshots
When:
Fn::Equals:
- '{{ snapshotType }}'
- Unrelated
Description:
en: Delete the unrelated snapshot
zh-cn: the description in Chinese
Properties:
rateControl: '{{ rateControl }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- snapshotType
- snapshotIds
- force
Label:
default:
zh-cn: the description in Chinese
en: Configure Parameters
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control Options