Tous les produits
Search
Centre de documentation

CloudOps Orchestration Service:ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup

Dernière mise à jour :Aug 11, 2026

Nom du modèle

ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup : exécute des commandes par lots sur les instances ECS du groupe de serveurs par défaut d'une instance SLB.

Exécuter maintenant

Description

Exécute des commandes par lots sur les instances ECS du groupe de serveurs par défaut d'une instance SLB.

Type de modèle

Automatisation

Propriétaire

Alibaba Cloud

Paramètres d'entrée

Nom du paramètre

Description

Type

Obligatoire

Valeur par défaut

Contraintes

loadBalancerId

ID de l'instance SLB.

String

Oui

commandType

Type de commande Cloud Assistant.

String

Non

RunShellScript

commandContent

Commande Cloud Assistant à exécuter sur les instances ECS.

String

Non

echo hello

rateControl

Taux de concurrence pour l'exécution des tâches.

Json

Non

{‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 1}

OOSAssumeRole

Rôle RAM assumé par OOS.

String

Non

""

Paramètres de sortie

Nom du paramètre

Description

Type

commandOutputs

List

Autorisations requises pour exécuter ce modèle

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "slb:DescribeLoadBalancerAttribute",
                "slb:SetBackendServers"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ecs:DescribeInvocationResults",
                "ecs:DescribeInvocations",
                "ecs:RunCommand"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Détails

Détails ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup

Contenu du modèle

FormatVersion: OOS-2019-06-01
Description:
  en: Runs commands in batches on ECS instances in the default server group of an SLB instance.
  name-en: ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup
  categories:
    - slb_management
Parameters:
  loadBalancerId:
    Label:
      en: SLB instance ID
    Type: String
  commandType:
    Label:
      en: Cloud Assistant command type
    Type: String
    AllowedValues:
      - RunBatScript
      - RunPowerShellScript
      - RunShellScript
    Default: RunShellScript
  commandContent:
    Label:
      en: Cloud Assistant command to run on the ECS instances
    Type: String
    AssociationProperty: Code
    Default: echo hello
  rateControl:
    Label:
      en: Task execution concurrency rate
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 1
  OOSAssumeRole:
    Label:
      en: RAM role for OOS to assume
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: describeLoadBalancerAttribute
    Action: ACS::ExecuteApi
    Description:
      en: Retrieves the attributes of the default server group for the SLB instance.
    Properties:
      Service: SLB
      API: DescribeLoadBalancerAttribute
      Parameters:
        LoadBalancerId: '{{ loadBalancerId }}'
    Outputs:
      BackendServers:
        Type: List
        ValueSelector: BackendServers.BackendServer[]
      port:
        Type: Number
        ValueSelector: ListenerPorts.ListenerPort[]
  - Name: runCommand
    Action: ACS::ECS::ElegantRunCommandInSLBDefaultServerGroup
    Description:
      en: Runs the Cloud Assistant command.
    Properties:
      loadBalancerId: '{{ LoadBalancerId }}'
      commandContent: '{{ commandContent }}'
      commandType: '{{ commandType }}'
      serverId:
        'Fn::Select':
          - ServerId
          - '{{ ACS::TaskLoopItem }}'
      weight:
        'Fn::Select':
          - Weight
          - '{{ ACS::TaskLoopItem }}'
      type:
        'Fn::Select':
          - Type
          - '{{ ACS::TaskLoopItem }}'
      port: '{{ describeLoadBalancerAttribute.port }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ describeLoadBalancerAttribute.BackendServers }}'
      Outputs:
        commandOutputs:
          AggregateType: Fn::ListJoin
          AggregateField: commandOutput
    Outputs:
      commandOutput:
        Type: String
        ValueSelector: commandOutput
Outputs:
  commandOutputs:
    Type: List
    Value: '{{ runCommand.commandOutputs }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - loadBalancerId
          - commandType
          - commandContent
        Label:
          default:
            en: Configure parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            en: Advanced options