All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyDownloadOSSFileAndRunCommand

Last Updated:Dec 23, 2025

Template name

ACS-ECS-BulkyDownloadOSSFileAndRunCommand: Downloads multiple OSS files to multiple ECS instances and executes a Cloud Assistant command.

Execute Now

Template description

Downloads a file from Object Storage Service (OSS) to multiple Elastic Compute Service (ECS) instances at a time and runs a Cloud Assistant command on the ECS instances.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

targets

Target instance

Json

Yes

bucketName

OSS Bucket Name

String

Yes

objectName

The name of the OSS object.

String

Yes

destinationDir

The directory to which the file is downloaded in the ECS instances.

String

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

OSSRegion

The region in which the OSS bucket resides.

String

No

{{ ACS::RegionId }}

URLExpirationTime

The validity period of the download URL of the OSS object.

Number

No

6000

whetherSaveToFile

Specifies whether to save the file content to a specific file.

Boolean

No

True

commandContent

The Cloud Assistant command to be run on the ECS instances.

String

No

echo hello

timeout

The timeout period for running the command on the ECS instances.

Number

No

600

rateControl

The rate control settings.

Json

No

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10}

OOSAssumeRole

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

String

No

""

Output parameters

None

Permission policy that is required to execute the template

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

Details

For more information, see ACS-ECS-BulkyDownloadOSSFileAndRunCommand.yml at GitHub.

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Bulky download an OSS file to instances and run a command.
  zh-cn: Bulky download an OSS file to instances and run a command.
  name-en: ACS-ECS-BulkyDownloadOSSFileAndRunCommand
  name-zh-cn: ACS-ECS-BulkyDownloadOSSFileAndRunCommand
  categories:
    - instance_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: Region ID
      zh-cn: Region ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Label:
      en: Target Instance
      zh-cn: Target Instance
    Type: Json
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  OSSRegion:
    Label:
      en: OSS Region
      zh-cn: OSS Region
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  bucketName:
    Label:
      en: Bucket Name
      zh-cn: Bucket Name
    Type: String
  objectName:
    Label:
      en: Object Name
      zh-cn: Object Name
    Type: String
  URLExpirationTime:
    Label:
      en: Download URL Expiration Time
      zh-cn: Download URL Expiration Time
    Type: Number
    Default: 6000
  destinationDir:
    Label:
      en: Destination Directory
      zh-cn: Destination Directory
    Type: String
  whetherSaveToFile:
    Label:
      en: Save to a Specific File
      zh-cn: Save to a Specific File
    Type: Boolean
    Default: true
  commandContent:
    Label:
      en: Command Content
      zh-cn: Command Content
    Type: String
    AssociationProperty: Code
    Default: echo hello
  timeout:
    Label:
      en: Timeout
      zh-cn: Timeout
    Type: Number
    Default: 600
  rateControl:
    Label:
      en: Rate Control
      zh-cn: Rate Control
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOS Assume Role
      zh-cn: OOS Assume Role
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: Retrieves the specified ECS instances.
      zh-cn: Retrieves the specified ECS instances.
    Action: 'ACS::SelectTargets'
    Properties:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'
  - Name: downloadOSSFileAndRunCommand
    Action: ACS::ECS::DownloadOSSFileAndRunCommand
    Description:
      en: Downloads the OSS file to the ECS instances and runs the command.
      zh-cn: Downloads the OSS file to the ECS instances and runs the command.
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
      bucketName: '{{ bucketName }}'
      objectName: '{{ objectName }}'
      URLExpirationTime: '{{ URLExpirationTime }}'
      OSSRegion: '{{ OSSRegion }}'
      destinationDir: '{{ destinationDir }}'
      whetherSaveToFile: '{{ whetherSaveToFile }}'
      commandContent: '{{ commandContent }}'
      timeout: '{{ timeout }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ getInstance.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: Select Instances
            en: Select Instances
      - Parameters:
          - OSSRegion
          - bucketName
          - objectName
          - URLExpirationTime
          - whetherSaveToFile
          - destinationDir
        Label:
          default:
            zh-cn: Configure Download File Parameters
            en: Configure Download File Parameters
      - Parameters:
          - commandContent
          - timeout
        Label:
          default:
            zh-cn: Configure Run Command Parameters
            en: Configure Run Command Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Advanced Options