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

CloudOps Orchestration Service:ACS-ECS-BulkyCopyImage

最終更新日:Dec 21, 2025

テンプレート名

ACS-ECS-BulkyCopyImage: リージョン間でのイメージのバッチクローン

今すぐ実行

テンプレートの説明

イメージを複数のリージョンに同時にクローン作成します。

テンプレートタイプ

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

タイプ

必須

デフォルト値

制限

imageId

ソースイメージの ID です。

String

はい

regionId

リージョン ID です。

String

いいえ

{{ ACS::RegionId }}

targetImageName

ターゲットイメージの名前。

String

いいえ

""

targetImageDescription

宛先リージョン ID

String

いいえ

""

targetRegionIds

ターゲットリージョンの ID。

List

いいえ

['all-regions']

rateControl

レート制御設定です。

Json

いいえ

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

OOSAssumeRole

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

String

いいえ

""

出力パラメーター

パラメーター

説明

タイプ

imageIds

List

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

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CopyImage",
                "ecs:DescribeImages",
                "ecs:DescribeRegions"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

詳細

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

テンプレートコンテンツ

FormatVersion: OOS-2019-06-01
Description:
  en: リージョン間でイメージをコピー
  zh-cn: 複数のリージョンにイメージをバッチコピーします。
  name-en: ACS-ECS-BulkyCopyImage
  name-zh-cn: リージョン間でのイメージのバッチコピー
  categories:
    - image_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: リージョン ID
      zh-cn: リージョン ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  imageId:
    Label:
      en: イメージ ID
      zh-cn: ソースイメージ ID
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
    AssociationPropertyMetadata:
      RegionId: regionId
      SupportedImageOwnerAlias:
        - self
  targetImageName:
    Label:
      en: ターゲットイメージ名
      zh-cn: ターゲットイメージ名
    Type: String
    Default: ''
  targetImageDescription:
    Label:
      en: ターゲットイメージの説明
      zh-cn: イメージの説明
    Type: String
    Default: ''
  targetRegionIds:
    Label:
      en: ターゲットリージョン ID
      zh-cn: ターゲットリージョン ID
    Type: List
    AllowedValues:
      - all-regions
      - cn-hangzhou
      - cn-shanghai
      - cn-nanjing
      - cn-qingdao
      - cn-beijing
      - cn-zhangjiakou
      - cn-huhehaote
      - cn-wulanchabu
      - cn-shenzhen
      - cn-heyuan
      - cn-guangzhou
      - cn-chengdu
      - cn-wuhan-lr
      - cn-fuzhou
      - cn-hongkong
      - ap-northeast-1
      - ap-northeast-2
      - ap-southeast-1
      - ap-southeast-2
      - ap-southeast-3
      - ap-southeast-5
      - ap-southeast-6
      - ap-southeast-7
      - ap-south-1
      - eu-central-1
      - eu-west-1
      - us-west-1
      - us-east-1
      - me-east-1
      - me-central-1
      - na-south-1
      - us-southeast-1
    Default:
      - all-regions
  rateControl:
    Label:
      en: レートコントロール
      zh-cn: 同時実行数制御
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 5
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS が引き受けるロール
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: queryAllAvailableRegions
    Action: 'ACS::ExecuteAPI'
    Description:
      en: 利用可能なすべてのリージョンを表示
      zh-cn: 利用可能なすべてのリージョンをクエリします。
    Properties:
      Service: ECS
      API: DescribeRegions
      Parameters:
        RegionId: '{{ACS::RegionId}}'
    Outputs:
      regionIds:
        Type: List
        ValueSelector: >-
          Regions.Region[]|.RegionId|select([scan("{{ACS::RegionId}}|test")]|length<1)
      allRegionsChosen:
        Type: String
        ValueSelector: '.|{{targetRegionIds}}|sort|.[0]'
  - Name: whetherCloneToAllRegions
    Action: 'ACS::Choice'
    Description:
      en: 選択された targetRegionIds に基づいて次のタスクを選択
      zh-cn: 選択されたターゲットリージョンに基づいて次のタスクを決定します。
    Properties:
      DefaultTask: copyImage
      Choices:
        - When:
            'Fn::Equals':
              - all-regions
              - '{{ queryAllAvailableRegions.allRegionsChosen }}'
          NextTask: copyImageToAllRegions
  - Name: copyImage
    Action: 'ACS::ECS::CopyImage'
    OnSuccess: 'ACS::END'
    OnError: 'ACS::END'
    Description:
      en: 選択されたリージョンにイメージをコピー
      zh-cn: 指定されたリージョンにイメージをコピーします。
    Properties:
      regionId: '{{ regionId }}'
      imageId: '{{ imageId }}'
      targetRegionId: '{{ ACS::TaskLoopItem }}'
      targetImageName: '{{ targetImageName }}'
      targetImageDescription: '{{ targetImageDescription }}'
    Loop:
      Items: '{{ targetRegionIds }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        imageIdsWithRegion:
          AggregateType: 'Fn::ListJoin'
          AggregateField: imageIdWithRegion
    Outputs:
      imageIdWithRegion:
        ValueSelector: '.|(.imageId),"{{ ACS::TaskLoopItem }}"'
        Type: List
  - Name: copyImageToAllRegions
    Action: 'ACS::ECS::CopyImage'
    Description:
      en: 利用可能なすべてのリージョンにイメージをコピー
      zh-cn: 利用可能なすべてのリージョンにイメージをコピーします。
    Properties:
      regionId: '{{ regionId }}'
      imageId: '{{ imageId }}'
      targetRegionId: '{{ ACS::TaskLoopItem }}'
      targetImageName: '{{ targetImageName }}'
      targetImageDescription: '{{ targetImageDescription }}'
    Loop:
      Items: '{{ queryAllAvailableRegions.regionIds }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        imageIdsWithRegion:
          AggregateType: 'Fn::ListJoin'
          AggregateField: imageIdWithRegion
    Outputs:
      imageIdWithRegion:
        ValueSelector: '.|(.imageId),"{{ ACS::TaskLoopItem }}"'
        Type: List
Outputs:
  imageIds:
    Type: List
    Value:
      'Fn::If':
        - 'Fn::Equals':
            - all-regions
            - '{{ queryAllAvailableRegions.allRegionsChosen }}'
        - '{{ copyImageToAllRegions.imageIdsWithRegion }}'
        - '{{ copyImage.imageIdsWithRegion }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - regionId
          - imageId
          - targetRegionIds
          - targetImageName
          - targetImageDescription
        Label:
          default:
            zh-cn: パラメーターの設定
            en: パラメーターの設定
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 詳細オプション
            en: 詳細オプション