全部产品
Search
文档中心

CloudOps Orchestration Service:ACS-ECS-BulkyCreateAndExportImage

更新时间:Dec 21, 2025

Nama Template

ACS-ECS-BulkyCreateAndExportImage – Membuat dan mengekspor citra secara batch ke bucket OSS

Eksekusi Sekarang

Deskripsi Template

Membuat citra untuk beberapa instance Elastic Compute Service (ECS) sekaligus dan mengekspornya ke bucket Object Storage Service (OSS).

Tipe Template

Otomatis

Pemilik

Alibaba Cloud

Parameter input

Parameter

Deskripsi

Tipe

Diperlukan

Nilai default

Batasan

targets

Instans target

Json

Ya

OSSBucket

Bucket OSS tempat citra akan diekspor.

String

Ya

tags

Tag dari citra.

Json

Tidak

[]

rateControl

Laju eksekusi tugas secara konkuren

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

Parameter

Deskripsi

Tipe

imageIds

List

Kebijakan Izin yang Diperlukan untuk Menjalankan Template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateImage",
                "ecs:DescribeImages",
                "ecs:DescribeInstances",
                "ecs:ExportImage"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Detail

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

Konten Template

FormatVersion: OOS-2019-06-01
Description:
  en: Batch creates and exports ECS images to an OSS bucket.
  zh-cn: Batch creates and exports ECS images to an OSS bucket.
  name-en: ACS-ECS-BatchCreateAndExportImage
  name-zh-cn: ACS-ECS-BatchCreateAndExportImage
  categories:
    - image_manage
Parameters:
  targets:
    Type: Json
    Label:
      en: Target Instance
      zh-cn: Target Instance
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: ALIYUN::ECS::Instance
  OSSBucket:
    Label:
      en: The OSS bucket for storing exported images.
      zh-cn: The OSS bucket for storing exported images.
    Type: String
  tags:
    Label:
      en: Image Tags
      zh-cn: Image Tags
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
    Default: []
  rateControl:
    Label:
      en: Concurrency rate for the task execution.
      zh-cn: Concurrency rate for the task execution.
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: The RAM role that OOS assumes.
      zh-cn: The RAM role that OOS assumes.
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
  Description:
    en: Retrieves the ECS instances.
    zh-cn: Retrieves the ECS instances.
  Action: ACS::SelectTargets
  Properties:
    ResourceType: ALIYUN::ECS::Instance
    Filters:
      - '{{ targets }}'
  Outputs:
    instanceIds:
      Type: List
      ValueSelector: Instances.Instance[].InstanceId
- Name: createImage
  Action: ACS::ECS::CreateImage
  Description:
    en: Creates a new image with the specified image name and instance ID.
    zh-cn: Creates a new image with the specified image name and instance ID.
  Properties:
    instanceId: '{{ ACS::TaskLoopItem }}'
    tags: '{{tags}}'
    imageName: 'image_of_{{ ACS::TaskLoopItem }}_{{ ACS::ExecutionId }}'
  Loop:
    Items: '{{ getInstance.instanceIds }}'
    RateControl: '{{ rateControl }}'
    Outputs:
      imageIds:
        AggregateType: 'Fn::ListJoin'
        AggregateField: imageId
  Outputs:
    imageId:
      ValueSelector: imageId
      Type: String
- Name: importImageToOSS
  Action: ACS::ExecuteApi
  Description:
    en: Exports the image to an OSS bucket.
    zh-cn: Exports the image to an OSS bucket.
  Properties:
    Service: ECS
    API: ExportImage
    Parameters:
      ImageId: '{{ ACS::TaskLoopItem }}'
      OSSBucket: '{{ OSSBucket }}'
  Loop:
    Items: '{{ createImage.imageIds }}'
    RateControl: '{{ rateControl }}'
Outputs:
  imageIds:
    Type: List
    Value: '{{ createImage.imageIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - targets
          - OSSBucket
          - tags
        Label:
          default:
            zh-cn: Configure Parameters
            en: Configure Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Advanced Options