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

CloudOps Orchestration Service:ACS-ECS-BulkyStopClassicInstances

最終更新日:Dec 21, 2025

テンプレート名

ACS-ECS-BulkyStopClassicInstances - クラシックネットワーク内の ECS インスタンスをバッチで停止します

今すぐ実行

テンプレートの説明

一度に複数のクラシックネットワーク接続の Elastic Compute Service (ECS) インスタンスを停止します。

テンプレートの種類

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

種類

必須

デフォルト値

制限

targets

停止する ECS インスタンス。

Json

はい

regionId

リージョン ID。

String

いいえ

{{ ACS::RegionId }}

stoppedMode

停止モード。

String

いいえ

KeepCharging

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-BulkyStopClassicInstances.yml をご参照ください。

テンプレートコンテンツ

FormatVersion: OOS-2019-06-01
Description:
  en: Bulk-stops classic network ECS instances.
  zh-cn: Bulk-stops classic network ECS instances.
  name-en: ACS-ECS-BulkStopClassicInstances
  name-zh-cn: BulkStopClassicInstances
  categories:
    - instance_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: Region ID
      zh-cn: Region ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Type: Json
    Label:
      en: Target Instance
      zh-cn: Target Instance
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  stoppedMode:
    Description:
      en: Specifies whether to continue billing for a pay-as-you-go ECS instance after it is stopped. For more information about StoppedMode, see the <a href="https://www.alibabacloud.com/help/document_detail/25501.html" target="_blank">documentation</a>.
      zh-cn: Specifies whether to continue billing for a pay-as-you-go ECS instance after it is stopped. For more information about StoppedMode, see the <a href="https://www.alibabacloud.com/help/document_detail/25501.html" target="_blank">documentation</a>.
    Label:
      en: Stopped Mode
      zh-cn: Stopped Mode
    Type: String
    AllowedValues:
      - StopCharging
      - KeepCharging
    Default: KeepCharging
    AssociationPropertyMetadata:
      LocaleKey: ECSStoppedMode
  rateControl:
    Label:
      en: Concurrency Rate
      zh-cn: Concurrency Rate
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: RAM Role for OOS
      zh-cn: RAM Role for OOS
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
  Description:
    en: Retrieves the ECS instances.
    zh-cn: Retrieves the ECS instances.
  Action: ACS::SelectTargets
  Properties:
    ResourceType: ALIYUN::ECS::Instance
    RegionId: '{{ regionId }}'
    Filters:
      - '{{ targets }}'
  Outputs:
    instanceIds:
      Type: List
      ValueSelector: .Instances.Instance | map(select( .InstanceNetworkType == "classic")) | .[].InstanceId
- Name: stopInstance
  Action: ACS::ECS::StopInstance
  Description:
    en: Stops the instances.
    zh-cn: Stops the instances.
  Properties:
    regionId: '{{ regionId }}'
    stoppedMode: '{{ stoppedMode }}'
    instanceId: '{{ ACS::TaskLoopItem }}'
  Loop:
    RateControl: '{{ rateControl }}'
    Items: '{{ getInstance.instanceIds }}'
Outputs:
  instanceIds:
    Type: List
    Value: '{{ getInstance.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - stoppedMode
        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: Advanced Options
            en: Advanced Options