すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:複数スナップショットの一括削除

最終更新日:Jan 17, 2025

テンプレート名

ACS-ECS-BulkyDeleteSnapshot

今すぐ実行

テンプレートの説明

複数のスナップショットを一度に削除します。

テンプレートタイプ

自動

所有者

Alibaba Cloud

入力パラメータ

パラメータ

説明

タイプ

必須

デフォルト値

制限

snapshotType

スナップショットタイプ。

String

いいえ

Specified

snapshotIds

削除するスナップショットの ID。

List

いいえ

[]

force

ディスクの作成に使用されたスナップショットを強制的に削除するかどうかを指定します。

Boolean

いいえ

False

rateControl

レート制御設定。

Json

いいえ

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

OOSAssumeRole

CloudOps Orchestration Service (OOS) によって引き受けられる Resource Access Management (RAM) ロール。

String

いいえ

""

出力パラメータ

なし

テンプレートの実行に必要な権限ポリシー

{
    "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"
        }
    ]
}

参照

詳細については、GitHub の ACS-ECS-BulkyDeleteSnapshot.yml をご参照ください。

テンプレートコンテンツ

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