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

CloudOps Orchestration Service:ACS-ECS-RunRemoteShellScript

最終更新日:Jun 23, 2026

テンプレート名

ACS-ECS-RunRemoteShellScript: Object Storage Service (OSS) から ECS インスタンスにシェルスクリプトをダウンロードして実行します。

今すぐ実行

テンプレートの説明

Cloud Assistant を使用して、OSS から ECS インスタンスにシェルスクリプトをダウンロードして実行します。

テンプレートタイプ

オートメーション

所有者

Alibaba Cloud

入力パラメーター

パラメーター名

説明

タイプ

必須

デフォルト値

制約

instanceId

スクリプトを実行する ECS インスタンスの ID。

String

はい

instanceRole

インスタンスにアタッチされている RAM ロール。

String

はい

fileName

実行するシェルスクリプトファイルの名前。

String

はい

srcUrl

スクリプトファイルが格納されている OSS ディレクトリ。

String

はい

destUrl

スクリプトファイルのコピー先となる ECS インスタンス上のディレクトリ。

String

はい

regionId

リージョン ID。

String

いいえ

{{ ACS::RegionId }}

workingDir

インスタンス上でコマンドが実行されるワーキングディレクトリ。

String

いいえ

/root

timeout

コマンド実行の最大タイムアウト時間。単位:秒。

Number

いいえ

600

OOSAssumeRole

OOS がこのテンプレートを実行するために引き受ける RAM ロール。

String

いいえ

出力パラメーター

パラメーター名

説明

タイプ

commandOutput

String

このテンプレートに必要なアクセスポリシー

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

詳細

ACS-ECS-RunRemoteShellScript の詳細

テンプレートの内容

FormatVersion: OOS-2019-06-01
Description:
  en: Runs a remote shell script.
  ja: リモートシェルスクリプトを実行します。
  zh-cn: Runs a remote shell script.
  name-en: ACS-ECS-RunRemoteShellScript
  name-ja: リモートシェルスクリプトの実行
  name-zh-cn: Run a remote shell script
  categories:
    - run_command
Parameters:
  regionId:
    Label:
      en: Region ID
      ja: リージョン ID
      zh-cn: Region ID
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceId:
    Label:
      en: ECS Instance
      ja: ECS インスタンス
      zh-cn: ECS Instance
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  instanceRole:
    Label:
      en: The RAM role attached to the instance
      ja: インスタンスにアタッチされている RAM ロール
      zh-cn: The RAM role attached to the instance
    Type: String
  fileName:
    Label:
      en: The name of the file to execute
      ja: 実行するファイルの名前
      zh-cn: The name of the file to execute
    Type: String
  srcUrl:
    Label:
      en: The directory in OSS where the file is located
      ja: ファイルが格納されている OSS 内のディレクトリ
      zh-cn: The directory in OSS where the file is located
    Type: String
  destUrl:
    Label:
      en: The directory on the ECS instance to which the file is copied
      ja: ファイルのコピー先となる ECS インスタンス上のディレクトリ
      zh-cn: The directory on the ECS instance to which the file is copied
    Type: String
  workingDir:
    Label:
      en: The directory on the instance where the command runs
      ja: コマンドが実行されるインスタンス上のディレクトリ
      zh-cn: The directory on the instance where the command runs
    Type: String
    Default: /root
  timeout:
    Label:
      en: The maximum timeout period for running the command
      ja: コマンド実行の最大タイムアウト時間
      zh-cn: The maximum timeout period for running the command
    Type: Number
    Default: 600
  OOSAssumeRole:
    Label:
      en: The RAM role that OOS assumes
      ja: OOS が引き受ける RAM ロール
      zh-cn: The RAM role that OOS assumes
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: copyOSSFileToInstance
    Description:
      en: Copies a file from OSS to a Linux instance.
      ja: OSS から Linux インスタンスにファイルをコピーします。
      zh-cn: Copies a file from OSS to a Linux instance.
    Action: 'ACS::ECS::CopyLinuxInstanceFileFromOSS'
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ instanceId }}'
      instanceRole: '{{ instanceRole }}'
      srcUrl: '{{ srcUrl }}/{{ fileName }}'
      destUrl: '{{ destUrl }}'
  - Name: runCommand
    Description:
      en: Executes a Cloud Assistant command.
      ja: Cloud Assistant コマンドを実行します。
      zh-cn: Executes a Cloud Assistant command.
    Action: 'ACS::ECS::RunCommand'
    Properties:
      regionId: '{{ regionId }}'
      commandContent: '/bin/bash {{ destUrl }}/{{ fileName }}'
      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:
          - instanceRole
          - fileName
          - srcUrl
          - destUrl
          - workingDir
          - timeout
        Label:
          default:
            zh-cn: Run Shell Script Options
            en: Run Shell Script Options
            ja: シェルスクリプト実行オプション
      - Parameters:
          - instanceId
        Label:
          default:
            zh-cn: Select ECS Instance
            en: Select ECS Instance
            ja: ECS インスタンスの選択
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Control Options
            en: Control Options
            ja: 制御オプション