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

CloudOps Orchestration Service:ACS-ECS-CloneInstancesAcrossAZ

最終更新日:Dec 21, 2025

テンプレート名

ACS-ECS-CloneInstancesAcrossAZ は、複数の ECS インスタンスをゾーン間でクローンします

今すぐ実行

テンプレートの説明

複数のアベイラビリティーゾーンにまたがって、複数の Elastic Compute Service(ECS)インスタンスを一度に複製します。

テンプレートタイプ

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

タイプ

必須

デフォルト値

制限

targets

ターゲットインスタンス

Json

はい

targetSecurityGroupId

複製された ECS インスタンスのセキュリティグループの ID。

String

はい

targetVSwitchId

複製された ECS インスタンスの vSwitch ID。このパラメーターを指定すると、ECS インスタンスの複製先のゾーンが指定されます。

String

はい

targetTags

複製された ECS インスタンスのタグ。

Json

はい

regionId

リージョン ID。

String

いいえ

{{ ACS::RegionId }}

targetResourceGroupId

複製された ECS インスタンスが追加されるリソースグループの ID。

String

いいえ

targetInstanceType

複製された ECS インスタンスのインスタンスタイプ。

String

いいえ

targetInstanceChargeType

複製された ECS インスタンスの課金方法。デフォルトでは、このパラメーターは PostPaid に設定されています。

String

いいえ

PostPaid

targetPeriodUnit

複製された ECS インスタンスの課金方法がサブスクリプションに設定されている場合に使用できるサブスクリプション期間の単位。デフォルトでは、このパラメーターは Month に設定されています。

String

いいえ

targetPeriod

複製された ECS インスタンスの課金方法がサブスクリプションに設定されている場合に使用できるサブスクリプション期間。デフォルトでは、このパラメーターは 1 に設定されています。

Number

いいえ

1

targetDeploymentSetId

複製された ECS インスタンスが属するデプロイメントセットの ID。

String

いいえ

targetInstanceName

インスタンス名

String

いいえ

targetHostName

複製された ECS インスタンスのホスト名。

String

いいえ

rateControl

ループ内のタスク実行の同時実行率とフォールトトレランス数

Json

いいえ

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

OOSAssumeRole

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

String

いいえ

""

出力パラメーター

パラメーター

説明

タイプ

instanceIds

List

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

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateImage",
                "ecs:DeleteImage",
                "ecs:DescribeAvailableResource",
                "ecs:DescribeDisks",
                "ecs:DescribeImages",
                "ecs:DescribeInstances",
                "ecs:DescribeVSwitches",
                "ecs:RunInstances"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

詳細

ACS-ECS-CloneInstancesAcrossAZ の詳細

テンプレートコンテンツ

FormatVersion: OOS-2019-06-01
Description:
  en: ゾーンをまたいで ECS インスタンスをバッチでクローンします。
  zh-cn: 跨可用区批量克隆ECS实例
  name-en: ACS-ECS-CloneInstancesAcrossAZ
  name-zh-cn: 跨可用区批量克隆ECS实例
  categories:
    - cross_region
Parameters:
  regionId:
    Type: String
    Label:
      en: リージョン ID
      zh-cn: 地域ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Label:
      en: ターゲットインスタンス
      zh-cn: 目标实例
    Type: Json
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  targetSecurityGroupId:
    Label:
      en: 新しいインスタンスのセキュリティグループ ID。
      zh-cn: 新实例的安全组ID
    Type: String
    AssociationProperty: 'ALIYUN::ECS::SecurityGroup::SecurityGroupId'
    AssociationPropertyMetadata:
      RegionId: regionId
  targetVSwitchId:
    Label:
      en: 新しいインスタンスの vSwitch ID。このパラメーターは、宛先ゾーンを決定します。
      zh-cn: 新实例的交换机ID,填写本参数时将会决定目的可用区
    Type: String
    AssociationProperty: 'ALIYUN::VPC::VSwitch::VSwitchId'
    AssociationPropertyMetadata:
      RegionId: regionId
      Filters:
        - SecurityGroupId: targetSecurityGroupId
  targetResourceGroupId:
    Label:
      en: 新しいインスタンスが追加されるリソースグループの ID。
      zh-cn: 新实例将加入的目的资源组ID
    Type: String
    Default: ' '
  targetInstanceType:
    Label:
      en: 新しいインスタンスのインスタンスタイプ。
      zh-cn: 新实例的规格
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
    AssociationPropertyMetadata:
      RegionId: regionId
    Default: ' '
  targetTags:
    Label:
      en: 新しいインスタンスのタグ。
      zh-cn: 新实例的标签
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
  targetInstanceChargeType:
    Label:
      en: 新しいインスタンスの課金方法。デフォルトは従量課金です。
      zh-cn: 新实例的付费模式,默认按量付费
    Type: String
    AllowedValues:
      - PrePaid
      - PostPaid
    Default: PostPaid
  targetPeriodUnit:
    Label:
      en: サブスクリプション期間の単位。このパラメーターは、課金方法がサブスクリプション (PrePaid) の場合にのみ必須です。デフォルトは Month です。
      zh-cn: 当新实例的付费方式选择包年包月时,请在此处选择时长单位,默认单位是月
    Type: String
    AllowedValues:
      - Week
      - Month
      - ' '
    Default: ' '
  targetPeriod:
    Label:
      en: サブスクリプション期間。このパラメーターは、課金方法がサブスクリプション (PrePaid) の場合にのみ必須です。デフォルトは 1 です。
      zh-cn: 当新实例的付费方式选择包年包月时,请在此处填写时长数,默认值为1
    Type: Number
    Default: 1
  targetDeploymentSetId:
    Label:
      en: 新しいインスタンスのデプロイメントセット ID。
      zh-cn: 新实例的部署集ID
    Type: String
    Default: ' '
  targetInstanceName:
    Label:
      en: 新しいインスタンスの名前。
      zh-cn: 新实例的名称
    Type: String
    Default: ' '
  targetHostName:
    Label:
      en: 新しいインスタンスのホスト名。
      zh-cn: 新实例的主机名称
    Type: String
    Default: ' '
  rateControl:
    Label:
      en: ループタスクの同時実行率とエラー許容数。
      zh-cn: 循环任务执行的并发率及容错数
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOS が引き受ける RAM ロール。
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: 指定された ECS インスタンスを取得します。
      zh-cn: 获取ECS实例
    Action: 'ACS::SelectTargets'
    Properties:
      RegionId: '{{regionId}}'
      ResourceType: 'ALIYUN::ECS::Instance'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'

  - Name: cloneInstancesAcrossAZ
    Action: 'ACS::Template'
    Description:
      en: インスタンスのクローン
      zh-cn: 克隆实例
    Properties:
      TemplateName: 'ACS::ECS::CloneInstanceAcrossAZ'
      Parameters:
        imageName: 'img-{{ ACS::TaskLoopItem }}-{{ACS::ExecutionId}}'
        instanceId: '{{ ACS::TaskLoopItem }}'
        targetSecurityGroupId: '{{ targetSecurityGroupId }}'
        targetResourceGroupId: '{{ targetResourceGroupId }}'
        targetVSwitchId: '{{ targetVSwitchId }}'
        regionId: '{{ regionId }}'
        targetInstanceName: '{{ targetInstanceName }}'
        targetInstanceChargeType: '{{ targetInstanceChargeType }}'
        targetPeriodUnit: '{{ targetPeriodUnit }}'
        targetPeriod: '{{ targetPeriod }}'
        targetInstanceType: '{{ targetInstanceType }}'
        targetHostName: '{{ targetHostName }}'
        targetDeploymentSetId: '{{ targetDeploymentSetId }}'
        tags: '{{ targetTags }}'
        OOSAssumeRole: '{{OOSAssumeRole}}'
    Loop:
      Items: '{{ getInstance.instanceIds }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        instanceIds:
          AggregateType: 'Fn::ListJoin'
          AggregateField: instanceId
    Outputs:
      instanceId:
        ValueSelector: instanceId
        Type: String
Outputs:
  instanceIds:
    Value: '{{ cloneInstancesAcrossAZ.instanceIds }}'
    Type: List
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - targetSecurityGroupId
          - targetVSwitchId
          - targetInstanceType
          - targetTags
          - targetInstanceChargeType
          - targetPeriodUnit
          - targetPeriod
          - targetResourceGroupId
          - targetDeploymentSetId
          - targetInstanceName
          - targetHostName
        Label:
          default:
            zh-cn: 设置参数
            en: パラメーターの設定
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: 选择实例
            en: インスタンスの選択
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 高级选项
            en: 高度なオプション