全部产品
Search
文档中心

CloudOps Orchestration Service:ACS-ECS-BulkyDeleteSnapshot

更新时间:Dec 21, 2025

Nama Template

ACS-ECS-BulkyDeleteSnapshot: Hapus snapshot secara batch

Eksekusi Sekarang

Deskripsi Template

Menghapus beberapa snapshot sekaligus.

Tipe Template

Otomatis

Pemilik

Alibaba Cloud

Parameter Input

Parameter

Deskripsi

Tipe

Diperlukan

Nilai Default

Batasan

snapshotType

Tipe snapshot.

String

Tidak

Ditentukan

snapshotIds

Snapshot ID

List

Tidak

[]

force

Menentukan apakah akan memaksa menghapus snapshot yang telah digunakan untuk membuat disk.

Boolean

Tidak

False

rateControl

Laju Eksekusi Tugas Concurrent

Json

Tidak

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

OOSAssumeRole

Peran Resource Access Management (RAM) yang diasumsikan oleh CloudOps Orchestration Service (OOS).

String

Tidak

""

Parameter keluaran

Tidak ada

Kebijakan izin yang diperlukan untuk mengeksekusi 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"
        }
    ]
}

Detail

Untuk informasi lebih lanjut, lihat ACS-ECS-BulkyDeleteSnapshot.yml di GitHub.

Konten Template

FormatVersion: OOS-2019-06-01
Description:
  en: Bulky delete snapshot
  zh-cn: Deletes multiple snapshots.
  name-en: ACS-ECS-BulkyDeleteSnapshot
  name-zh-cn: Batch-Delete-Snapshots
  categories:
    - data_backup
Parameters:
  snapshotType:
    Label:
      en: SnapshotType
      zh-cn: Snapshot Type
    Description:
      en: 'Specified: Specified snapshot, Unrelated: Unrelated snapshot'
      zh-cn: 'Specified: specified snapshots. Unrelated: unassociated snapshots.'
    Type: String
    Default: Specified
    AllowedValues:
      - Specified
      - Unrelated
  snapshotIds:
    Label:
      en: SnapshotIds
      zh-cn: Snapshot IDs
    Type: List
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${snapshotType}
            - Specified
    Default: []
  force:
    Label:
      en: Force
      zh-cn: Force Delete Snapshots Associated with Disks
    Type: Boolean
    Default: false
  rateControl:
    Label:
      en: RateControl
      zh-cn: Task Execution Concurrency Rate
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: RAM Role for OOS
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Conditions:
  SpecifiedSnapshot:
    Fn::Equals:
      - '{{ snapshotType }}'
      - Specified
  UnrelatedSnapshot:
    Fn::Equals:
      - '{{ snapshotType }}'
      - Unrelated
Tasks:
  - Name: deleteSnapshot
    Action: ACS::ExecuteAPI
    When: SpecifiedSnapshot
    Description:
      en: Delete the specified snapshot
      zh-cn: Deletes the specified snapshots.
    Properties:
      Service: ECS
      API: DeleteSnapshot
      Parameters:
        Force: '{{ force }}'
        SnapshotId: '{{ ACS::TaskLoopItem }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ snapshotIds }}'
  - Name: deleteUnrelatedSnapshot
    Action: ACS::ECS::DeleteUnrelatedSnapshots
    When: UnrelatedSnapshot
    Description:
      en: Delete the unrelated snapshot
      zh-cn: Deletes the unassociated snapshots.
    Properties:
      rateControl: '{{ rateControl }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - snapshotType
          - snapshotIds
          - force
        Label:
          default:
            zh-cn: Configure Parameters
            en: Configure Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Control Options
            en: Control Options