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

CloudOps Orchestration Service:ACS-ECS-RunShellScript

最終更新日:Dec 21, 2025

テンプレート名

ACS-ECS-RunShellScript:シェルスクリプトを実行します。

今すぐ実行

テンプレートの説明

シェルスクリプトを実行します。

テンプレートの種類

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

種類

必須

デフォルト値

制限

instanceId

ECS インスタンス。

String

はい

commandContent

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

String

はい

workingDir

コマンドを実行する ECS インスタンスのディレクトリ。

String

はい

regionId

リージョン ID。

String

いいえ

{{ ACS::RegionId }}

timeout

最大タイムアウト期間。単位:秒。

Number

いいえ

600

OOSAssumeRole

CloudOps Orchestration Service (OOS) によって引き受けられる Resource Access Management (RAM) ロール。

String

いいえ

""

出力パラメーター

パラメーター

説明

種類

commandOutput

String

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

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

詳細

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

テンプレートコンテンツ

FormatVersion: OOS-2019-06-01
Description:
  en: Run shell script.
  title: ACS-ECS-RunShellScript
  categories:
    - run_command
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceId:
    Label:
      en: InstanceId
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  commandContent:
    Label:
      en: CommandContent
    Type: String
    AssociationProperty: Code
  workingDir:
    Label:
      en: WorkingDir
    Type: String
  timeout:
    Label:
      en: Timeout
    Type: Number
    Default: 600
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: runCommand
  Description:
    en: Execute cloud assistant command
  Action: ACS::ECS::RunCommand
  Properties:
    regionId: '{{ regionId }}'
    commandContent: "{{ commandContent }}"
    instanceId: '{{ instanceId }}'
    commandType: RunShellScript
    workingDir: "{{ workingDir }}"
    timeout: "{{ timeout }}"
  Outputs:
    commandOutput:
      Type: String
      ValueSelector: invocationOutput
Outputs:
  commandOutput:
    Type: String
    Value: '{{ runCommand.commandOutput }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - commandContent
          - workingDir
          - timeout
        Label:
          default:
            en: run command options
      - Parameters:
          - regionId
          - instanceId
        Label:
          default:
            en: Select ECS Instances
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            en: Control Options