すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:ACS-ECS-BulkyCreateAndExportImage

最終更新日:Dec 21, 2025

テンプレート名

ACS-ECS-BulkyCreateAndExportImage - イメージをバッチで作成し、OSS バケットにエクスポートします

今すぐ実行

テンプレートの説明

複数の Elastic Compute Service (ECS) インスタンスのイメージを一度に作成し、Object Storage Service (OSS) バケットにエクスポートします。

テンプレートの種類

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

種類

必須

デフォルト値

制限

targets

ターゲットインスタンス

Json

はい

OSSBucket

イメージのエクスポート先となる OSS バケット。

String

はい

tags

イメージのタグ。

Json

いいえ

[]

rateControl

タスクの同時実行レート

Json

いいえ

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

OOSAssumeRole

CloudOps Orchestration Service (OOS) によって引き受けられる Resource Access Management (RAM) ロール。

String

いいえ

""

出力パラメーター

パラメーター

説明

種類

imageIds

List

テンプレートを実行するために必要な権限ポリシー

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

詳細

詳細については、GitHub の ACS-ECS-BulkyCreateAndExportImage.yml をご参照ください。

テンプレートの内容

FormatVersion: OOS-2019-06-01
Description:
  en: ECS イメージをバッチで作成し、OSS バケットにエクスポートします。
  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: ターゲットインスタンス
      zh-cn: Target Instance
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: ALIYUN::ECS::Instance
  OSSBucket:
    Label:
      en: エクスポートされたイメージを格納する OSS バケット。
      zh-cn: The OSS bucket for storing exported images.
    Type: String
  tags:
    Label:
      en: イメージタグ
      zh-cn: Image Tags
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
    Default: []
  rateControl:
    Label:
      en: タスク実行の同時実行レート。
      zh-cn: Concurrency rate for the task execution.
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOS が引き受ける RAM ロール。
      zh-cn: The RAM role that OOS assumes.
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
  Description:
    en: ECS インスタンスを取得します。
    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: 指定されたイメージ名とインスタンス 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: イメージを OSS バケットにエクスポートします。
    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: パラメーターの設定
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: 詳細オプション