All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-RunShellScript

Last Updated:Dec 20, 2025

Template name

ACS-ECS-RunShellScript: Runs a shell script.

Execute Now

Template description

Running a shell script

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

instanceId

ECS instance

String

Yes

commandContent

The Cloud Assistant command.

String

Yes

workingDir

The directory of the ECS instance in which the command is run.

String

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

timeout

The maximum timeout period. Unit: seconds.

Number

No

600

OOSAssumeRole

The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS).

String

No

""

Output parameters

Parameter

Description

Type

commandOutput

String

Permission policy that is required to execute the template

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

Details

For more information, see ACS-ECS-RunShellScript.yml at 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