Tous les produits
Search
Centre de documentation

CloudOps Orchestration Service:ACS-ECS-BulkyStopClassicInstances

Dernière mise à jour :Aug 11, 2026

Nom du modèle

ACS-ECS-BulkyStopClassicInstances : arrêt par lot des instances ECS dans le réseau classique

Exécuter maintenant

Description du modèle

Arrête par lot les instances Elastic Compute Service (ECS) connectées au réseau classique.

Type de modèle

Automatisé

Propriétaire

Alibaba Cloud

Paramètres d'entrée

Paramètre

Description

Type

Obligatoire

Valeur par défaut

Limite

targets

Les instances ECS à arrêter.

Json

Oui

regionId

ID de la région.

String

Non

{{ ACS::RegionId }}

stoppedMode

Mode d'arrêt.

String

Non

KeepCharging

rateControl

Paramètres de concurrence pour l'exécution des tâches.

Json

Non

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

OOSAssumeRole

Rôle RAM endossé par CloudOps Orchestration Service (OOS).

String

Non

""

Paramètres de sortie

Paramètre

Description

Type

instanceIds

List

Stratégie d'autorisation requise pour exécuter le modèle

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:StopInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Détails

Pour plus d'informations, consultez le fichier ACS-ECS-BulkyStopClassicInstances.yml sur GitHub.

Contenu du modèle

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