All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-RunShellScript

Last Updated:Jun 04, 2026

Template name

ACS-ECS-RunShellScript: Runs a shell script.

Execute Now

Template description

Runs a shell script

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

instanceId

The ECS instance ID.

String

Yes

commandContent

The Cloud Assistant command.

String

Yes

workingDir

The working directory on the ECS instance.

String

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

timeout

Maximum timeout, in seconds.

Number

No

600

OOSAssumeRole

The Resource Access Management (RAM) role assumed by OOS.

String

No

""

Output parameters

Parameter

Description

Type

commandOutput

String

Required permission policy

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

Details

The full template definition is available in ACS-ECS-RunShellScript.yml on GitHub.

Template content

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