模板名称
ACS-ECS-BulkyRunCommandAcrossRegions 批量在多个地域的ECS实例上运行云助手命令
模板描述
批量在多个地域的ECS实例上运行云助手命令
模板类型
自动化
所有者
Alibaba Cloud
输入参数
参数名称  | 描述  | 类型  | 是否必填  | 默认值  | 约束  | 
instanceInfos  | ECS实例的信息列表  | List  | 否  | []  | |
commandType  | 云助手命令类型  | String  | 否  | RunShellScript  | |
commandContent  | 在ECS实例中执行的云助手命令  | String  | 否  | echo hello  | |
timeout  | ECS实例中执行命令的超时时间  | Number  | 否  | 600  | |
rateControl  | 任务执行的并发比率  | Json  | 否  | {‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 10}  | |
OOSAssumeRole  | OOS扮演的RAM角色  | String  | 否  | “”  | 
输出参数
参数名称  | 描述  | 类型  | 
commandOutputs  | List  | 
执行此模板需要的权限策略
{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInvocationResults",
                "ecs:DescribeInvocations",
                "ecs:RunCommand"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}
详情
ACS-ECS-BulkyRunCommandAcrossRegions详情
模板内容
FormatVersion: OOS-2019-06-01
Description:
  en: Bulky run command on ECS instances across multiple regions
  zh-cn: 批量在多个地域的ECS实例上运行云助手命令
  name-en: ACS-ECS-BulkyRunCommandAcrossRegions
  name-zh-cn: 批量在多个地域的ECS实例上运行云助手命令
  categories:
    - run_command
Parameters:
  instanceInfos:
    Description:
      en: 'Format: {"regionId": "cn-xxx", "instanceId": "i-xxx"}'
      zh-cn: '格式: {"regionId": "cn-xxx", "instanceId": "i-xxx"}'
    Label:
      en: InstanceInfos
      zh-cn: ECS实例的信息列表
    Type: List
    Default: []
  commandType:
    Label:
      en: CommandType
      zh-cn: 云助手命令类型
    Type: String
    AllowedValues:
      - RunBatScript
      - RunPowerShellScript
      - RunShellScript
    Default: RunShellScript
  commandContent:
    Label:
      en: CommandContent
      zh-cn: 在ECS实例中执行的云助手命令
    Type: String
    AssociationProperty: Code
    Default: echo hello
  timeout:
    Label:
      en: Timeout
      zh-cn: ECS实例中执行命令的超时时间
    Type: Number
    Default: 600
  rateControl:
    Label:
      en: RateControl
      zh-cn: 任务执行的并发比率
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: runCommand
    Action: ACS::ECS::RunCommand
    Description:
      en: Execute cloud assistant command
      zh-cn: 执行云助手命令
    Properties:
      regionId:
        'Fn::Select':
          - regionId
          - '{{ ACS::TaskLoopItem }}'
      instanceId:
        'Fn::Select':
          - instanceId
          - '{{ ACS::TaskLoopItem }}'
      commandContent: '{{ commandContent }}'
      commandType: '{{ commandType }}'
      timeout: '{{ timeout }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ instanceInfos }}'
      Outputs:
        commandOutputs:
          AggregateType: Fn::ListJoin
          AggregateField: commandOutput
    Outputs:
      commandOutput:
        Type: String
        ValueSelector: invocationOutput
Outputs:
  commandOutputs:
    Type: List
    Value: '{{ runCommand.commandOutputs }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - instanceInfos
          - commandType
          - commandContent
          - timeout
        Label:
          default:
            zh-cn: 设置参数
            en: Configure Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 高级选项
            en: Control Options该文章对您有帮助吗?