All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyRunCommandInSLBVServerGroup

Last Updated:Jun 22, 2026

Template name

ACS-ECS-BulkyRunCommandInSLBVServerGroup: Runs commands in a batch on ECS instances in an SLB virtual server group.

Execute now

Template description

Runs commands in a batch on ECS instances in an SLB virtual server group.

Template type

Automation

Owner

Alibaba Cloud

Input parameters

Parameter name

Description

Type

Required

Default value

Constraints

VServerGroupId

The ID of the server group.

String

Yes

commandType

The type of the Cloud Assistant command.

String

No

RunShellScript

commandContent

The Cloud Assistant command to run on ECS instances.

String

No

echo hello

rateControl

The concurrency rate for task execution.

Json

No

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

OOSAssumeRole

The RAM role that OOS assumes.

String

No

“”

Output parameters

Parameter name

Description

Type

commandOutputs

List

Access policy required for this template

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

Details

Details of ACS-ECS-BulkyRunCommandInSLBVServerGroup

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Bulky run command on ECS instances of VServer group
  zh-cn: Runs commands in a batch on ECS instances in an SLB virtual server group.
  name-en: ACS-ECS-BulkyRunCommandInSLBVServerGroup
  name-zh-cn: Runs commands in a batch on ECS instances in an SLB virtual server group.
  categories:
    - slb_management
Parameters:
  VServerGroupId:
    Label:
      en: VServerGroupId
      zh-cn: The ID of the server group.
    Type: String
  commandType:
    Label:
      en: CommandType
      zh-cn: The type of the Cloud Assistant command.
    Type: String
    AllowedValues:
      - RunBatScript
      - RunPowerShellScript
      - RunShellScript
    Default: RunShellScript
  commandContent:
    Label:
      en: CommandContent
      zh-cn: The Cloud Assistant command to run on the ECS instances.
    Type: String
    AssociationProperty: Code
    Default: echo hello
  rateControl:
    Label:
      en: RateControl
      zh-cn: The concurrency rate for the task execution.
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 1
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role that OOS assumes.
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: describeVServerGroupAttribute
    Action: ACS::ExecuteApi
    Description:
      en: Views vserver group attribute
      zh-cn: Views the attributes of the service group.
    Properties:
      Service: SLB
      API: DescribeVServerGroupAttribute
      Parameters:
        VServerGroupId: '{{ VServerGroupId }}'
    Outputs:
      BackendServers:
        Type: List
        ValueSelector: BackendServers.BackendServer[]
  - Name: runCommand
    Action: ACS::ECS::ElegantRunCommandInSLBVServerGroup
    Description:
      en: Execute cloud assistant command
      zh-cn: Executes the Cloud Assistant command.
    Properties:
      VServerGroupId: '{{ VServerGroupId }}'
      commandContent: '{{ commandContent }}'
      commandType: '{{ commandType }}'
      serverId:
        'Fn::Select':
          - ServerId
          - '{{ ACS::TaskLoopItem }}'
      weight:
        'Fn::Select':
          - Weight
          - '{{ ACS::TaskLoopItem }}'
      type:
        'Fn::Select':
          - Type
          - '{{ ACS::TaskLoopItem }}'
      port:
        'Fn::Select':
          - Port
          - '{{ ACS::TaskLoopItem }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ describeVServerGroupAttribute.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:
          - VServerGroupId
          - commandType
          - commandContent
        Label:
          default:
            zh-cn: Configure Parameters
            en: Configure Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Control
            en: Control