All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup

Last Updated:Jun 23, 2026

Nama Templat

ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup: Menjalankan perintah secara batch pada Instance ECS dalam kelompok server default dari sebuah Instance SLB.

Run now

Deskripsi

Menjalankan perintah secara batch pada Instance ECS dalam kelompok server default dari sebuah Instance SLB.

Jenis Templat

Automation

Pemilik

Alibaba Cloud

Parameter input

Parameter Name

Description

Type

Required

Default

Constraints

loadBalancerId

ID Instance SLB.

String

Yes

commandType

Jenis perintah Cloud Assistant.

String

No

RunShellScript

commandContent

Perintah Cloud Assistant yang akan dijalankan pada Instance ECS.

String

No

echo hello

rateControl

Laju konkurensi untuk eksekusi task.

Json

No

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

OOSAssumeRole

Peran RAM yang diasumsikan oleh OOS.

String

No

""

Parameter output

Parameter Name

Description

Type

commandOutputs

List

Izin yang diperlukan untuk menjalankan templat ini

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

Detail

Detail ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup

Konten templat

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