Todos os produtos
Search
Central de documentação

CloudOps Orchestration Service:ACS-ECS-BulkyCreateAndExportImage

Última atualização: Jun 28, 2026

Nome do template

ACS-ECS-BulkyCreateAndExportImage - Cria e exporta imagens em lote para um bucket OSS

Execute Now

Descrição do template

Cria imagens para várias instâncias do Elastic Compute Service (ECS) em lote e as exporta para um bucket do Object Storage Service (OSS).

Tipo de template

Automated

Proprietário

Alibaba Cloud

Parâmetros de entrada

Parâmetro

Descrição

Tipo

Obrigatório

Valor padrão

Limite

targets

As instâncias ECS para as quais criar e exportar imagens.

Json

Sim

OSSBucket

O bucket OSS para o qual exportar as imagens.

String

Sim

tags

As tags das imagens.

Json

Não

[]

rateControl

A taxa em que as tarefas são executadas simultaneamente.

Json

Não

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

OOSAssumeRole

A função do Resource Access Management (RAM) assumida pelo CloudOps Orchestration Service (OOS).

String

Não

""

Parâmetros de saída

Parâmetro

Descrição

Tipo

imageIds

List

Política de permissões necessária para executar o template

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

Detalhes

Para mais informações, consulte ACS-ECS-BulkyCreateAndExportImage.yml no GitHub.

Conteúdo do 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