テンプレート名
ACS-ECS-BulkyStopInstances:インスタンスの一括停止
テンプレートの説明
複数の Elastic Compute Service (ECS) インスタンスを一度に停止します。これにより、リソースを最適化し、コストを管理できます。設定時に、リージョン ID (regionId) とターゲットインスタンス (targets) を指定する必要があります。テンプレートの実行後、停止したインスタンスの ID リストが返されます。これにより、インスタンスのステータスを確認できます。
テンプレートの種類
自動
所有者
Alibaba Cloud
入力パラメータ
パラメータ | 説明 | 種類 | 必須 | デフォルト値 | 制限 |
targets | ターゲットインスタンス | Json | はい | ||
regionId | リージョン ID。 | String | いいえ | {{ ACS::RegionId }} | |
stoppedMode | 停止モード。 | String | いいえ | KeepCharging | |
forceStop | ECS インスタンスを強制的に停止するかどうかを指定します。 | Boolean | いいえ | False | |
rateControl | タスク実行の同時実行数 | Json | いいえ | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | CloudOps Orchestration Service (OOS) によって引き受けられる Resource Access Management (RAM) ロール。 | String | いいえ | "" |
出力パラメータ
パラメータ | 説明 | 種類 |
instanceIds | List |
テンプレートの実行に必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:StopInstance"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
詳細については、GitHub の ACS-ECS-BulkyStopInstances.yml をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
ja: '複数の ECS インスタンスを一度に停止します。これは、リソースの最適化とコスト管理に役立ちます。リージョン ID (regionId) とターゲットインスタンス (targets) を指定する必要があります。テンプレートは、検証のために停止したインスタンス ID のリストを返します。'
name-ja: 'インスタンスの一括停止'
en: 'Stops multiple ECS instances at once. This is useful for optimizing resources and managing costs. You must specify the region ID (regionId) and target instances (targets). The template returns a list of stopped instance IDs for verification.'
name-en: 'Bulky Stop Instances'
categories:
- instance_manage
- application_manage
- computenest
Parameters:
regionId:
Type: String
Label:
ja: リージョン ID
en: RegionId
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
ja: ターゲットインスタンス
en: TargetInstance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
stoppedMode:
Description:
ja: 'StoppedMode の詳細については、<a href="https://www.alibabacloud.com/help/document_detail/25501.html" target="_blank">ドキュメント</a>をご参照ください。'
en: For details about StoppedMode, see the <a href="https://www.alibabacloud.com/help/document_detail/25501.html" target="_blank">documentation</a>.
Label:
ja: 停止モード
en: StoppedMode
Type: String
Default: KeepCharging
AssociationProperty: ALIYUN::ECS::Instance::StopMode
forceStop:
Label:
ja: 強制停止
en: ForceStop
Type: Boolean
Default: false
rateControl:
Label:
ja: レート制御
en: RateControl
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
ja: OOSAssumeRole
en: OOSAssumeRole
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
ja: ECS インスタンスを表示します
en: Views the ECS instances
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
- Name: stopInstance
Action: ACS::ECS::StopInstance
Description:
ja: ECS インスタンスを停止します
en: Stops the ECS instances
Properties:
regionId: '{{ regionId }}'
stoppedMode: '{{ stoppedMode }}'
instanceId: '{{ ACS::TaskLoopItem }}'
forceStop: '{{ forceStop }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.Instances.Instance[].InstanceId }}'
Outputs:
instanceIds:
Type: List
Value: '{{ getInstance.Instances.Instance[].InstanceId }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- stoppedMode
Label:
default:
ja: パラメーターの設定
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
ja: ECS インスタンスの選択
en: Select ECS Instances
- Parameters:
- forceStop
- rateControl
- OOSAssumeRole
Label:
default:
ja: 制御オプション
en: Control Options