すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:複数リージョンにわたる ECS インスタンスでのコマンドの一括実行

最終更新日:Jan 17, 2025

テンプレート名

ACS-ECS-BulkyRunCommandAcrossRegions

今すぐ実行

テンプレートの説明

複数リージョンにわたる複数の Elastic Compute Service (ECS) インスタンスで、クラウドアシスタントコマンドを一度に実行します。

テンプレートの種類

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

種類

必須

デフォルト値

制限

instanceInfos

ECS インスタンスに関する情報。

リスト

いいえ

[]

commandType

クラウドアシスタントコマンドの種類。

文字列

いいえ

RunShellScript

commandContent

ECS インスタンスで実行されるクラウドアシスタントコマンド。

文字列

いいえ

echo hello

timeout

ECS インスタンスでコマンドを実行するためのタイムアウト期間。

数値

いいえ

600

rateControl

レート制御設定。

JSON

いいえ

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

OOSAssumeRole

CloudOps Orchestration Service (OOS) によってアシュームされる Resource Access Management (RAM) ロール。

文字列

いいえ

""

出力パラメーター

パラメーター

説明

種類

commandOutputs

リスト

テンプレートを実行するために必要な権限ポリシー

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

参照

詳細については、GitHub の ACS-ECS-BulkyRunCommandAcrossRegions.yml をご参照ください。

テンプレートの内容

FormatVersion: OOS-2019-06-01
Description:
  en: Bulky run command on ECS instances across multiple regions
  zh-cn: the description in Chinese
  name-en: ACS-ECS-BulkyRunCommandAcrossRegions
  name-zh-cn: the description in Chinese
  categories:
    - run_command
Parameters:
  instanceInfos:
    Description:
      en: 'Format: {"regionId": "cn-xxx", "instanceId": "i-xxx"}'
      zh-cn: the description in Chinese
    Label:
      en: InstanceInfos
      zh-cn: インスタンス情報
    Type: List
    Default: []
  commandType:
    Label:
      en: CommandType
      zh-cn: コマンドの種類
    Type: String
    AllowedValues:
      - RunBatScript
      - RunPowerShellScript
      - RunShellScript
    Default: RunShellScript
  commandContent:
    Label:
      en: CommandContent
      zh-cn: コマンドの内容
    Type: String
    AssociationProperty: Code
    Default: echo hello
  timeout:
    Label:
      en: Timeout
      zh-cn: タイムアウト
    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 アシュームロール
    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