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

CloudOps Orchestration Service:複数 ECS インスタンスの一括クローン

最終更新日:Jan 17, 2025

テンプレート名

ACS-ECS-BulkyCloneInstances

今すぐ実行

テンプレートの説明

複数の Elastic Compute Service (ECS) インスタンスを一度にクローン作成します。次の点にご注意ください。

  • インスタンスのクローンを作成する前に、必要なすべてのドライバがソースインスタンスにインストールされていることを確認してください。そうでない場合、クローン作成されたインスタンスが起動に失敗する可能性があります。

  • クローン作成プロセスは、イメージとスナップショットに基づいて実装されます。クローン作成中に生成されるデータを含め、ソースインスタンスのすべてのデータをクローンインスタンスに保持する場合は、IncrementSnapshot パラメータを True に設定します。クローン作成中に生成されたデータを保持したくない場合は、IncrementSnapshot パラメータを False に設定します。最初に IncrementSnapshot を False に設定し、クローン作成されたインスタンスでビジネスが期待どおりに実行されるかどうかをテストすることをお勧めします。クローン作成されたインスタンスでビジネスが期待どおりに実行される場合は、IncrementSnapshot パラメータを True に設定してすべてのデータを移行できます。

  • スナップショットの作成に必要な時間は数分以内であり、ディスクのサイズによって異なります。ディスクに対して最初に作成されるスナップショットは完全スナップショットです。完全スナップショットの作成に必要な時間は数時間かかる場合があります。ディスクに対して subsequently に作成されるスナップショットは増分スナップショットです。完全スナップショットの作成には、増分スナップショットよりも時間がかかります。増分スナップショットの作成に必要な時間は、以前のスナップショット以降に変更されたデータ量によって異なります。変更されたデータ量が増加するにつれて、増分スナップショットの作成に必要な時間も増加します。

  • ディスクがインスタンスに自動的にアタッチできることを確認してください。そうでない場合、移行後にインスタンスが再起動されたときに、ディスクがインスタンスにアタッチされません。

  • クローン作成操作はリスクの高い操作です。 IncrementSnapshot パラメータを true に設定する場合は、インスタンスのシャットダウンがビジネスに与える影響を制御できることを確認してください。

  • クローン作成されたインスタンスにパブリック IP アドレスと Elastic IP アドレス (EIP) を手動で関連付ける必要があります。詳細については、「クラシックネットワークのインスタンスのシステム割り当てパブリック IP アドレスを EIP に変換する」、「VPC の ECS インスタンスのパブリック IP アドレスを EIP に変換する」、および「インスタンスのプライベート IP アドレスを変更する」をご参照ください。

  • テンプレートを実行する前に、ソースインスタンスのスナップショットを作成できます。これにより、実行が高速化されます。

  • クローン作成されたインスタンスを購入するのに十分なアカウント残高があることを確認してください。

テンプレートタイプ

自動

所有者

Alibaba Cloud

入力パラメータ

パラメータ

説明

タイプ

必須

デフォルト値

制限

instanceIds

クローン作成する ECS インスタンス。

リスト

はい

targetZoneId

クローン作成された ECS インスタンスのゾーン ID。

文字列

はい

targetInstanceChargeType

クローン作成された ECS インスタンスの課金方法。

文字列

はい

targetInstanceType

クローン作成された ECS インスタンスのインスタンスタイプ。

文字列

はい

targetVPCId

クローン作成された ECS インスタンスの仮想プライベートネットワーク (VPN) ID。

文字列

はい

targetVSwitchId

クローン作成された ECS インスタンスの vSwitch ID。

文字列

はい

targetSecurityGroupIds

クローン作成された ECS インスタンスが追加されるセキュリティグループの ID。

リスト

はい

targetSystemDiskCategory

システムディスクのカテゴリ。

文字列

はい

targetDataDiskCategory

データディスクのカテゴリ。

文字列

はい

targetPassword

クローン作成された ECS インスタンスにアクセスするために使用されるパスワード。

文字列

はい

文字列検証の正規表現: [0-9A-Za-z_-&:;'<>,=%`~!@#()$^*+|{}[].?/]+$

値は 8 ~ 30 文字の長さでなければなりません。

regionId

クローン作成する ECS インスタンスが存在するリージョン。

文字列

いいえ

{{ ACS::RegionId }}

targetPeriodUnit

サブスクリプション期間の単位。

文字列

いいえ

targetPeriod

サブスクリプション期間。

数値

いいえ

1

useIncrementSnapshot

ソース ECS インスタンスを停止して増分スナップショットを作成するかどうかを指定します。

ブール値

いいえ

False

OOSAssumeRole

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

文字列

いいえ

""

出力パラメータ

パラメータ

説明

タイプ

instanceIds

リスト

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

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateImage",
                "ecs:CreateSnapshot",
                "ecs:DeleteImage",
                "ecs:DeleteSnapshot",
                "ecs:DescribeAvailableResource",
                "ecs:DescribeDisks",
                "ecs:DescribeImages",
                "ecs:DescribeInstances",
                "ecs:DescribeSnapshots",
                "ecs:DescribeVSwitches",
                "ecs:RunInstances",
                "ecs:StartInstance",
                "ecs:StopInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

参照

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

テンプレートコンテンツ

FormatVersion: OOS-2019-06-01
Description:
  en: <p class="p">Clone ECS instances in batches. Note:</p> <ul class="ul"> <li class="li">Please check for missing drivers before migrating, so as not to cause the new instance to fail to start. </li> <li class="li">Based on mirror snapshot migration, if you need to retain complete data, please select <font color='blue'>Incremental snapshots for downtime</font> as Yes, and then go to the next step; if you do not need to retain data generated during the migration process, select No and migrate directly according to the guidelines. <font color='red'>It is recommended that you select No to test whether the new instance is normal, and then select Yes to ensure complete data. </font></li> <li class="li">The time required to create a snapshot is in minutes and depends on the size of the cloud disk. The first snapshot of the cloud disk is a full snapshot, which takes a long time and may be at the hour level. Creating a snapshot again takes a relatively short time, but still depends on the amount of data changes since the last snapshot. The bigger the change, the longer it will take. </li> <li class="li"><font color='red'>Because the machine will restart, please make sure that the data disk has been set to be automatically mounted. Ootherwise, the data disk will not be mounted after restarting. </font></li> <li class="li"><font color='red'>The current operation is a high-risk operation. If you select Yes for snapshot migration, please confirm that the business impact of the shutdown is controllable. </font></li> <li class="li"><font color='red'>Public IP and Elastic IP need to be manually re-bound to the new instance. Refer to the documentation: <a href='https://www.alibabacloud.com/help/document_detail/156287.html'>Classic network type ECS public IP is converted to elastic public IP</a>, <a href='https://www.alibabacloud.com/help/document_detail/67455.html'>Convert the fixed public IP of the VPC ECS instance to EIP</a>, <a href='https://www.alibabacloud.com/help/document_detail/27733.html'>Modify private IP address</a></font></li> <li class="li">Take a snapshot of the instance before execution, which will greatly shorten the execution time. </li> <li class="li"><font color='red'>Please make sure that your account balance is greater than the cost of the newly purchased instance. </font></li> </ul>
  zh-cn: バッチで ECS インスタンスをクローン作成します。注記: <ul class="ul"> <li class="li">移行前に不足しているドライバを確認して、新しいインスタンスが起動に失敗しないようにしてください。</li> <li class="li">ミラー スナップショット移行に基づいて、完全なデータを保持する必要がある場合は、<font color='blue'>ダウンタイムの増分スナップショット</font> を [はい] に選択して、次の手順に進みます。移行プロセス中に生成されたデータを保持する必要がない場合は、[いいえ] を選択して、ガイドラインに従って直接移行します。<font color='red'>[いいえ] を選択して新しいインスタンスが正常かどうかをテストしてから、[はい] を選択して完全なデータが確実に保持されるようにすることをお勧めします。</font></li> <li class="li">スナップショットの作成に必要な時間は数分であり、クラウド ディスクのサイズによって異なります。クラウド ディスクの最初のスナップショットは完全スナップショットであり、時間がかかり、時間レベルになる場合があります。スナップショットを再度作成すると比較的短時間で済みますが、それでも最後のスナップショット以降のデータ変更量によって異なります。変更が大きいほど、時間がかかります。</li> <li class="li"><font color='red'>マシンが再起動するため、データ ディスクが自動的にマウントされるように設定されていることを確認してください。そうでない場合、再起動後にデータ ディスクはマウントされません。</font></li> <li class="li"><font color='red'>現在の操作はリスクの高い操作です。スナップショット移行で [はい] を選択した場合は、シャットダウンのビジネスへの影響を制御できることを確認してください。</font></li> <li class="li"><font color='red'>パブリック IP と Elastic IP は、新しいインスタンスに手動で再バインドする必要があります。ドキュメントを参照してください: <a href='https://www.alibabacloud.com/help/document_detail/156287.html'>クラシック ネットワーク タイプの ECS パブリック IP は Elastic パブリック IP に変換されます</a>、<a href='https://www.alibabacloud.com/help/document_detail/67455.html'>VPC ECS インスタンスの固定パブリック IP を EIP に変換する</a>、<a href='https://www.alibabacloud.com/help/document_detail/27733.html'>プライベート IP アドレスを変更する</a></font></li> <li class="li">実行前にインスタンスのスナップショットを取得すると、実行時間が大幅に短縮されます。</li> <li class="li"><font color='red'>アカウントの残高が新しく購入したインスタンスのコストよりも大きいことを確認してください。</font></li> </ul>
  name-en: ACS-ECS-BulkyCloneInstances
  name-zh-cn: 複数 ECS インスタンスの一括クローン
  categories:
    - cross_region
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: リージョン ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceIds:
    Label:
      en: InstanceIds
      zh-cn: インスタンス ID
    Type: List
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  targetZoneId:
    Label:
      en: TargetZoneId
      zh-cn: ターゲットゾーン ID
    Description:
      en: For more instance purchase information, please refer to the ECS purchase page
      zh-cn: インスタンス購入の詳細については、ECS 購入ページを参照してください
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      RegionId: regionId
  targetInstanceChargeType:
    Label:
      en: TargetInstanceChargeType
      zh-cn: ターゲットインスタンスの課金タイプ
    Type: String
    AssociationProperty: ChargeType
  targetPeriodUnit:
    Label:
      en: The unit of the subscription period
      zh-cn: サブスクリプション期間の単位
    Type: String
    AssociationPropertyMetadata:
      Visible:
        Condition:
          'Fn::Not':
            'Fn::Equals':
              - '${targetInstanceChargeType}'
              - PostPaid
    AllowedValues:
      - Week
      - Month
    Default: Month
  targetPeriod:
    Label:
      en: TargetPeriod
      zh-cn: ターゲット期間
    Description:
      en: "Valid values:
          Valid values when PeriodUnit is set to Week: 1, 2, 3, and 4.
          Valid values when PeriodUnit is set to Month: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60."
      zh-cn: 有効な値: PeriodUnit が Week に設定されている場合の有効な値: 1、2、3、4。PeriodUnit が Month に設定されている場合の有効な値: 1、2、3、4、5、6、7、8、9、12、24、36、48、60。


    Type: Number
    AssociationPropertyMetadata:
      Visible:
        Condition:
          'Fn::Not':
            'Fn::Equals':
              - '${targetInstanceChargeType}'
              - PostPaid
    AllowedValues:
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
      - 9
      - 12
      - 24
      - 36
      - 48
      - 60
    Default: 1
  targetInstanceType:
    Label:
      en: TargetInstanceType
      zh-cn: ターゲットインスタンスタイプ
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      RegionId: regionId
      ZoneId: targetZoneId
      InstanceChargeType: targetInstanceChargeType
  targetVPCId:
    Label:
      en: TargetVPCId
      zh-cn: ターゲット VPC ID
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    AssociationPropertyMetadata:
      RegionId: regionId
  targetVSwitchId:
    Label:
      en: TargetVSwitchId
      zh-cn: ターゲット vSwitch ID
    Description:
      en: Please confirm whether the switch is in the selected zone. If not, please reselect or create a new switch
      zh-cn: スイッチが選択したゾーンにあることを確認してください。そうでない場合は、再選択するか、新しいスイッチを作成してください
    Type: String
    AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      RegionId: regionId
      ZoneId: targetZoneId
      VpcId: targetVPCId
  targetSecurityGroupIds:
    Label:
      en: TargetSecurityGroupIds
      zh-cn: ターゲットセキュリティグループ ID
    Description:
      en: The vSwitch and the security group must belong to the same VPC
      zh-cn: vSwitch とセキュリティグループは同じ VPC に属している必要があります
    Type: List
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    AssociationPropertyMetadata:
      RegionId: regionId
      VpcId: targetVPCId
  targetSystemDiskCategory:
    Label:
      en: TargetSystemDiskCategory
      zh-cn: ターゲットシステムディスクカテゴリ
    Type: String
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      RegionId: regionId
      ZoneId: targetZoneId
      InstanceType: targetInstanceType
      InstanceChargeType: targetInstanceChargeType
  targetDataDiskCategory:
    Label:
      en: TargetDataDiskCategory
      zh-cn: ターゲットデータディスクカテゴリ
    Type: String
    AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
    AssociationPropertyMetadata:
      RegionId: regionId
      ZoneId: targetZoneId
      InstanceType: targetInstanceType
      InstanceChargeType: targetInstanceChargeType
  targetPassword:
    Label:
      en: TargetPassword
      zh-cn: ターゲットパスワード
    Description:
      en: "<font color='red'><b>The password must be 8 to 30 characters in length and include at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.</b></font>Special characters include the following: ()`~!@#$%^&*-_+=|{}[]:;''<>,.?/  Passwords of Windows instances cannot start with a forward slash (/)."
      zh-cn: <font color='red'><b>パスワードは 8 ~ 30 文字の長さで、次の文字タイプのうち少なくとも 3 つを含める必要があります: 大文字、小文字、数字、特殊文字。</b></font>特殊文字には、() `~!@#$%^&*-_+=|{}[]:;''<>,.?/ が含まれます。 Windows インスタンスのパスワードはスラッシュ (/) で始めることはできません。
    Type: String
    AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
    MinLength: 8
    MaxLength: 30
    NoEcho: true
  useIncrementSnapshot:
    Type: Boolean
    Description:
      en: <p class="p">Note:</p> <ul class="ul"> <li class="li">If you select Yes, to ensure data consistency to the greatest extent, the system will stop the source instance after the full snapshot (downtime charging mode), create an incremental snapshot, create a destination instance based on the incremental snapshot and start it run. <font color='red'>If the task is successfully executed, the source instance will remain in the down state. You can manually release it as soon as possible after verifying that the business of the destination instance is normal to avoid repeated charges. </font>If the task fails, restart the source instance. </li> <li class="li">If you select No (the default is No), to ensure that the source machine is always available, the system will create the destination instance based on the full snapshot and start it after the full snapshot. <font color='red'>But the incremental data after the task is started will not be synchronized to the destination instance, which may cause data inconsistency, please be aware. </font></li></ul>
      zh-cn: 注記: <ul class="ul"> <li class="li">[はい] を選択した場合、データ整合性を最大限に確保するために、システムは完全スナップショット (ダウンタイム課金モード) 後にソースインスタンスを停止し、増分スナップショットを作成し、増分スナップショットに基づいて宛先インスタンスを作成して実行を開始します。<font color='red'>タスクが正常に実行されると、ソースインスタンスはダウン状態のままになります。宛先インスタンスのビジネスが正常であることを確認した後、できるだけ早く手動でリリースして、料金が繰り返し発生しないようにすることができます。</font>タスクが失敗した場合は、ソースインスタンスを再起動します。</li> <li class="li">[いいえ] を選択した場合 (デフォルトは [いいえ])、ソースマシンを常に使用できるようにするために、システムは完全スナップショットに基づいて宛先インスタンスを作成し、完全スナップショット後に起動します。<font color='red'>ただし、タスクの開始後に増分データは宛先インスタンスに同期されないため、データの不整合が発生する可能性があることに注意してください。</font></li></ul>
    Label:
      en: IncrementSnapshot
      zh-cn: 増分スナップショット
    Default: false
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS 引き受けロール
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: cloneInstances
    Action: ACS::ECS::CloneInstance
    Description:
      en: Clone ECS instances
      zh-cn: ECS インスタンスのクローン作成
    When:
      'Fn::Equals':
        - '{{ useIncrementSnapshot }}'
        - false
    Properties:
      regionId: '{{ regionId }}'
      imageName: img-{{ ACS::TaskLoopItem }}-{{ACS::ExecutionId}}
      instanceId: '{{ ACS::TaskLoopItem }}'
      targetVSwitchId: '{{ targetVSwitchId }}'
      targetInstanceType: '{{ targetInstanceType }}'
      targetSecurityGroupIds: '{{ targetSecurityGroupIds }}'
      targetPassword: '{{ targetPassword }}'
      targetInstanceChargeType: '{{ targetInstanceChargeType }}'
      targetPeriodUnit: '{{ targetPeriodUnit }}'
      targetPeriod: '{{ targetPeriod }}'
      targetSystemDiskCategory: '{{ targetSystemDiskCategory }}'
      targetDataDiskCategory: '{{ targetDataDiskCategory }}'
    Loop:
      Items: '{{ instanceIds }}'
      RateControl:
        Mode: Concurrency
        MaxErrors: 0
        Concurrency: 10
      Outputs:
        instanceIds:
          AggregateType: Fn::ListJoin
          AggregateField: instanceId
    Outputs:
      instanceId:
        Type: String
        ValueSelector: instanceId
  - Name: cloneInstancesWithIncrementSnapshot
    Action: ACS::ECS::CloneInstanceWithIncrementSnapshot
    Description:
      en: Clone ECS instances with increment snapshot
      zh-cn: 増分スナップショットを使用して ECS インスタンスのクローンを作成する
    When:
      'Fn::Equals':
        - '{{ useIncrementSnapshot }}'
        - true
    Properties:
      regionId: '{{ regionId }}'
      imageName: img-{{ ACS::TaskLoopItem }}-{{ACS::ExecutionId}}
      instanceId: '{{ ACS::TaskLoopItem }}'
      targetVSwitchId: '{{ targetVSwitchId }}'
      targetInstanceType: '{{ targetInstanceType }}'
      targetSecurityGroupIds: '{{ targetSecurityGroupIds }}'
      targetPassword: '{{ targetPassword }}'
      targetInstanceChargeType: '{{ targetInstanceChargeType }}'
      targetPeriodUnit: '{{ targetPeriodUnit }}'
      targetPeriod: '{{ targetPeriod }}'
      targetSystemDiskCategory: '{{ targetSystemDiskCategory }}'
      targetDataDiskCategory: '{{ targetDataDiskCategory }}'
    Loop:
      Items: '{{ instanceIds }}'
      RateControl:
        Mode: Concurrency
        MaxErrors: 0
        Concurrency: 10
      Outputs:
        instanceIds:
          AggregateType: Fn::ListJoin
          AggregateField: instanceId
    Outputs:
      instanceId:
        Type: String
        ValueSelector: instanceId
Outputs:
  instanceIds:
    Type: List
    Value:
      Fn::If:
        - 'Fn::Equals':
            - '{{ useIncrementSnapshot }}'
            - true
        - '{{ cloneInstancesWithIncrementSnapshot.instanceIds }}'
        - '{{ cloneInstances.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - regionId
          - instanceIds
        Label:
          default:
            zh-cn: インスタンスを選択
            en: Select Instances
      - Parameters:
          - targetZoneId
          - targetInstanceChargeType
          - targetPeriodUnit
          - targetPeriod
          - targetInstanceType
          - targetVPCId
          - targetVSwitchId
          - targetSecurityGroupIds
          - targetSystemDiskCategory
          - targetDataDiskCategory
          - targetPassword
        Label:
          default:
            zh-cn: パラメータを設定
            en: Configure Parameters
      - Parameters:
          - useIncrementSnapshot
        Label:
          default:
            en: IncrementSnapshot
            zh-cn: 増分スナップショット
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 制御オプション
            en: Control Options