テンプレート名
ACS-ECS-BulkyDeleteExpiredImage
テンプレートの説明
期限切れのイメージを複数同時に削除します。
テンプレート
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | タイプ | 必須 | デフォルト値 | 制限 |
expiredDays | イメージの期限が切れてから経過した日数。 | 数値 | はい | ||
regionId | リージョン ID。 | 文字列 | いいえ | {{ ACS::RegionId }} | |
force | イメージを強制的に削除するかどうかを指定します。 | ブール値 | いいえ | False | |
imageName | イメージをフィルタリングするために使用される名前フィールド。 | 文字列 | いいえ | ||
tags | イメージのタグ。 | JSON | いいえ | [] | |
rateControl | レート制御設定。 | JSON | いいえ | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | CloudOps Orchestration Service ( OOS ) によって引き受けられる Resource Access Management ( RAM ) ロール。 | 文字列 | いいえ | "" |
出力パラメーター
パラメーター | 説明 | タイプ |
deletedImageIds | リスト |
テンプレートを実行するために必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DeleteImage",
"ecs:DescribeImages"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
参照
詳細については、GitHub の ACS-ECS-BulkyDeleteExpiredImage.yml をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: Bulky delete expired image
zh-cn: the description in Chinese
name-en: ACS-ECS-BulkyDeleteExpiredImage
name-zh-cn: the description in Chinese
categories:
- image_manage
Parameters:
regionId:
Label:
en: RegionId
zh-cn: the description in Chinese
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
force:
Label:
en: Forced deletion of Image
zh-cn: the description in Chinese
Type: Boolean
Default: false
expiredDays:
Label:
en: Image Expiration Days
zh-cn: the description in Chinese
Type: Number
imageName:
Label:
en: Name Field Used To Filter Images
zh-cn: the description in Chinese
Type: String
Default: " "
tags:
Label:
en: Image Tags
zh-cn: the description in Chinese
Type: Json
AssociationProperty: Tags
AssociationPropertyMetadata:
ShowSystem: false
Default: []
rateControl:
Label:
en: Rate Control
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: describeImages
Action: 'ACS::ExecuteAPI'
Description:
en: Get the images
zh-cn: the description in Chinese
Properties:
Service: ECS
API: DescribeImages
Parameters:
RegionId: '{{ regionId }}'
ImageOwnerAlias: self
Tags: '{{ tags }}'
Filter:
- Key: CreationEndTime
Value:
'Fn::FormatUTCTime':
- 'Fn::AddHour':
- '{{ ACS::CurrentUTCTime }}'
- "Fn::Eval":
- '-{{ expiredDays }}*24'
- '%Y-%m-%dT00:00Z'
Outputs:
imageIds:
Type: List
ValueSelector: '.Images.Image[] | select( .ImageName | test("{{imageName}}")) | .ImageId'
- Name: deleteImages
Action: 'ACS::ExecuteAPI'
Description:
en: Delete the images
zh-cn: the description in Chinese
Properties:
Service: ECS
API: DeleteImage
Parameters:
RegionId: '{{ regionId }}'
ImageId: '{{ ACS::TaskLoopItem }}'
Force: '{{ force }}'
Loop:
Items: '{{ describeImages.imageIds }}'
RateControl: '{{ rateControl }}'
Outputs:
deletedImageIds:
Type: List
Value: '{{ describeImages.imageIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- expiredDays
- imageName
- tags
- 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