Todos los productos
Search
Centro de documentos

CloudOps Orchestration Service:ACS-ECS-RunRemoteShellScript

Última actualización: Sep 05, 2026

Nombre de la plantilla

ACS-ECS-RunRemoteShellScript: descarga un script de shell desde OSS a una instancia ECS y lo ejecuta.

Ejecutar ahora

Descripción de la plantilla

Descarga un script de shell desde Object Storage Service (OSS) a una instancia ECS y lo ejecuta mediante Cloud Assistant.

Tipo de plantilla

Automatización

Propietario

Alibaba Cloud

Parámetros de entrada

Nombre del parámetro

Descripción

Tipo

Obligatorio

Valor predeterminado

Restricciones

instanceId

ID de la instancia ECS donde se ejecutará el script.

String

Sí

instanceRole

Rol RAM asociado a la instancia.

String

Sí

fileName

Nombre del archivo de script de shell por ejecutar.

String

Sí

srcUrl

Directorio de OSS donde se almacena el archivo de script.

String

Sí

destUrl

Directorio de destino en la instancia ECS donde se copia el archivo de script.

String

Sí

regionId

ID de la región.

String

No

{{ ACS::RegionId }}

workingDir

Directorio de trabajo en la instancia donde se ejecuta el comando.

String

No

/root

timeout

Tiempo máximo de espera para ejecutar el comando. Unidad: segundos.

Number

No

600

OOSAssumeRole

Rol RAM que asume OOS para ejecutar esta plantilla.

String

No

“”

Parámetros de salida

Nombre del parámetro

Descripción

Tipo

commandOutput

String

Política de acceso obligatoria para esta plantilla

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

Detalles

Detalles de ACS-ECS-RunRemoteShellScript

Contenido de la plantilla

FormatVersion: OOS-2019-06-01
Description:
  en: Runs a remote shell script.
  zh-cn: Runs a remote shell script.
  name-en: ACS-ECS-RunRemoteShellScript
  name-zh-cn: Run a remote shell script
  categories:
    - run_command
Parameters:
  regionId:
    Label:
      en: Region ID
      zh-cn: Region ID
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceId:
    Label:
      en: ECS Instance
      zh-cn: ECS Instance
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  instanceRole:
    Label:
      en: The RAM role attached to the instance
      zh-cn: The RAM role attached to the instance
    Type: String
  fileName:
    Label:
      en: The name of the file to execute
      zh-cn: The name of the file to execute
    Type: String
  srcUrl:
    Label:
      en: The directory in OSS where the file is located
      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
      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
      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
      zh-cn: The maximum timeout period for running the command
    Type: Number
    Default: 600
  OOSAssumeRole:
    Label:
      en: The RAM role that OOS assumes
      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.
      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.
      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
      - Parameters:
          - instanceId
        Label:
          default:
            zh-cn: Select ECS Instance
            en: Select ECS Instance
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Control Options
            en: Control Options