Tous les produits
Search
Centre de documentation

CloudOps Orchestration Service:ACS-ECS-RunRemoteShellScript

Dernière mise à jour :Aug 11, 2026

Nom du modèle

ACS-ECS-RunRemoteShellScript : télécharge un script shell depuis OSS vers une instance ECS et l'exécute.

Exécuter maintenant

Description du modèle

Télécharge un script shell depuis Object Storage Service (OSS) vers une instance ECS et l'exécute à l'aide de Cloud Assistant.

Type de modèle

Automatisation

Propriétaire

Alibaba Cloud

Paramètres d'entrée

Nom du paramètre

Description

Type

Obligatoire

Valeur par défaut

Contraintes

instanceId

ID de l'instance ECS sur laquelle exécuter le script.

String

Oui

instanceRole

Rôle RAM associé à l'instance.

String

Oui

fileName

Nom du fichier de script shell à exécuter.

String

Oui

srcUrl

Répertoire OSS où est stocké le fichier de script.

String

Oui

destUrl

Répertoire de destination sur l'instance ECS où copier le fichier de script.

String

Oui

regionId

ID de la région.

String

Non

{{ ACS::RegionId }}

workingDir

Répertoire de travail sur l'instance dans lequel exécuter la commande.

String

Non

/root

timeout

Délai d'expiration maximal pour l'exécution de la commande, en secondes.

Number

Non

600

OOSAssumeRole

Rôle RAM qu'OOS endosse pour exécuter ce modèle.

String

Non

“”

Paramètres de sortie

Nom du paramètre

Description

Type

commandOutput

String

Stratégie d'accès requise pour ce modèle

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

Détails

Détails du modèle ACS-ECS-RunRemoteShellScript

Contenu du modèle

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