All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyDownloadOSSFileAndRunCommand

Last Updated:Jun 04, 2026

Template name

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

Execute Now

Template description

Downloads an OSS file to multiple ECS instances and runs a Cloud Assistant command on these instances.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

targets

Target ECS instances.

Json

Yes

bucketName

OSS bucket name.

String

Yes

objectName

OSS object name.

String

Yes

destinationDir

Download destination directory on ECS instances.

String

Yes

regionId

Region ID.

String

No

{{ ACS::RegionId }}

OSSRegion

Region of the OSS bucket.

String

No

{{ ACS::RegionId }}

URLExpirationTime

Validity period of the OSS object download URL.

Number

No

6000

whetherSaveToFile

Whether to save downloaded content to a file.

Boolean

No

True

commandContent

Cloud Assistant command to run on the ECS instances.

String

No

echo hello

timeout

Command execution timeout.

Number

No

600

rateControl

Rate control settings.

Json

No

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

OOSAssumeRole

RAM role assumed by OOS.

String

No

""

Output parameters

None

Required permission policy

{
    "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

View the template source on GitHub: ACS-ECS-BulkyDownloadOSSFileAndRunCommand.yml.

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