テンプレート名
ACS-ECS-BulkyTagInstances:ECS インスタンスにタグを一括でアタッチします
テンプレートの説明
複数の Elastic Compute Service (ECS) インスタンスに一度にタグを追加します。
テンプレートの種類
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | 種類 | 必須 | デフォルト値 | 制限 |
targets | ターゲットインスタンス | Json | はい | ||
tags | ECS インスタンスに追加するタグ。 | Json | はい | ||
regionId | リージョン ID。 | String | いいえ | {{ ACS::RegionId }} | |
rateControl | タスク実行の同時実行率 | Json | いいえ | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | CloudOps Orchestration Service (OOS) がアシュームする Resource Access Management (RAM) ロール。 | String | いいえ | "" |
出力パラメーター
なし
テンプレートの実行に必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:TagResources"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
詳細については、GitHub の ACS-ECS-BulkyTagInstances.yml をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS-ECS-BulkyTagInstances
name-zh-cn: Batch attach tags to ECS instances
en: Bulky tag ECS instances
zh-cn: Batch attach tags to ECS instances
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: Target Instance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
tags:
Label:
en: Tags
zh-cn: Tags to attach to the ECS instances
Type: Json
AssociationProperty: Tags
rateControl:
Label:
en: RateControl
zh-cn: Concurrency rate for task execution
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: The RAM role assumed by OOS
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: Views the ECS instances
Action: 'ACS::SelectTargets'
Properties:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: tagResources
Action: 'ACS::ExecuteApi'
Description:
en: Creates and attaches tag to ECS instance
zh-cn: Creates and attaches tag to ECS instance
Properties:
Service: ECS
API: TagResources
Parameters:
RegionId: '{{ regionId }}'
ResourceIds:
- '{{ ACS::TaskLoopItem }}'
ResourceType: Instance
Tags: '{{ tags }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- tags
Label:
default:
zh-cn: Configure Parameters
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: Select Ecs Instances
en: Select Ecs Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Control Options
en: Control Options