全部产品
Search
文档中心

CloudOps Orchestration Service:ACS-ECS-BulkyDownloadOSSFileAndRunCommand

更新时间:Dec 21, 2025

Nama Template

ACS-ECS-BulkyDownloadOSSFileAndRunCommand: Mengunduh beberapa file dari Object Storage Service (OSS) ke beberapa instance Elastic Compute Service (ECS) dan mengeksekusi perintah Cloud Assistant.

Eksekusi Sekarang

Deskripsi Template

Mengunduh file dari Object Storage Service (OSS) ke beberapa instance Elastic Compute Service (ECS) sekaligus dan menjalankan perintah Cloud Assistant pada instance ECS tersebut.

Tipe Template

Otomatis

Pemilik

Alibaba Cloud

Parameter masukan

Parameter

Deskripsi

Tipe

Diperlukan

Nilai Default

Batasan

targets

Target instance

Json

Ya

bucketName

OSS Bucket Name

String

Ya

objectName

Nama objek OSS.

String

Ya

destinationDir

Direktori tempat file akan diunduh di instance ECS.

String

Ya

regionId

ID wilayah.

String

Tidak

{{ ACS::RegionId }}

OSSRegion

Wilayah tempat bucket OSS berada.

String

Tidak

{{ ACS::RegionId }}

URLExpirationTime

Periode validitas URL unduhan objek OSS.

Number

Tidak

6.000

whetherSaveToFile

Menentukan apakah akan menyimpan isi file ke file tertentu.

Boolean

Tidak

True

commandContent

Perintah Cloud Assistant yang akan dijalankan pada instance ECS.

String

Tidak

echo hello

timeout

Periode timeout untuk menjalankan perintah pada instance ECS.

Number

Tidak

600

rateControl

Pengaturan kontrol laju.

Json

Tidak

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

OOSAssumeRole

Peran Resource Access Management (RAM) yang diasumsikan oleh CloudOps Orchestration Service (OOS).

String

Tidak

""

Parameter Keluaran

Tidak ada

Kebijakan izin yang diperlukan untuk mengeksekusi 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"
        }
    ]
}

Rincian

Untuk informasi lebih lanjut, lihat ACS-ECS-BulkyDownloadOSSFileAndRunCommand.yml di GitHub.

Isi Template

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