Todos os produtos
Search
Central de documentação

CloudOps Orchestration Service:ACS-ECS-BulkyCloneInstances

Última atualização: Jun 28, 2026

Nome do modelo

ACS-ECS-BulkyCloneInstances: Clonar instâncias ECS em lote

Executar agora

Descrição

Clona instâncias ECS em lote mediante a criação de snapshots de imagem. Observação:

  • Antes da migração, verifique se há drivers ausentes para evitar falhas na inicialização das novas instâncias.

  • Para preservar todos os dados, defina "Create incremental snapshots for stopped instances" como Yes. Caso não precise dos dados gerados durante a migração, defina como No. Faça um teste inicial com No e, após confirmar o funcionamento das novas instâncias, execute novamente com Yes para garantir a integridade total dos dados.

  • O tempo de criação do snapshot varia conforme o tamanho do disco. O primeiro snapshot completo pode levar horas. Os snapshots incrementais são mais rápidos, mas dependem do volume de dados alterados desde o último snapshot.

  • As instâncias reiniciam durante este processo. Certifique-se de que os discos de dados estejam configurados para anexação automática; caso contrário, eles não serão anexados após a reinicialização.

  • Esta é uma operação de risco. Se optar pela migração via snapshot com desligamento, confirme se o impacto nos negócios é aceitável.

  • Reanexe manualmente os endereços IP públicos e EIPs às novas instâncias: Converter o endereço IP público de uma instância ECS de rede clássica em EIP, Converter o endereço IP público estático de uma instância ECS VPC em EIP e Endereço IP privado primário.

  • Criar snapshots previamente reduz significativamente o tempo de execução do modelo.

  • Garanta saldo suficiente na conta para cobrir os custos das novas instâncias.

Tipo de modelo

Automation

Proprietário

Alibaba Cloud

Parâmetros de entrada

Nome do parâmetro

Descrição

Tipo

Obrigatório

Valor padrão

Restrições

instanceIds

IDs das instâncias ECS a clonar.

List

Sim

targetZoneId

Zona de destino das instâncias clonadas.

String

Sim

targetInstanceChargeType

Método de faturamento das novas instâncias.

String

Sim

targetInstanceType

Tipo das instâncias clonadas.

String

Sim

targetVPCId

VPC de destino.

String

Sim

targetVSwitchId

vSwitch de destino.

String

Sim

targetSecurityGroupIds

Grupo de segurança de destino.

List

Sim

targetSystemDiskCategory

Categoria do disco do sistema.

String

Sim

targetDataDiskCategory

Categoria do disco de dados.

String

Sim

targetPassword

Senha de login das novas instâncias.

String

Sim

Expressão regular de validação de string: [0-9A-Za-z_-&:;'<>,=%`~!@#()$^*+|{}[].?/]+$

Comprimento máximo: 30

Comprimento mínimo: 8|

regionId

Região das instâncias ECS de origem.

String

Não

{{ ACS::RegionId }}

targetPeriodUnit

Unidade da duração da assinatura.

String

Não

Month

targetPeriod

Duração da assinatura.

Number

Não

1

useIncrementSnapshot

Indica se devem ser criados snapshots incrementais para instâncias paradas.

Boolean

Não

False

OOSAssumeRole

Função RAM assumida pelo OOS.

String

Não

""

Parâmetros de saída

Nome do parâmetro

Descrição

Tipo

instanceIds

List

Permissões necessárias para executar este modelo

{
    "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"
        }
    ]
}

Detalhes

Detalhes do ACS-ECS-BulkyCloneInstances

Conteúdo do modelo

FormatVersion: OOS-2019-06-01
Description:
  en: <p class="p">Clones Elastic Compute Service (ECS) instances in batches. Note:</p> <ul class="ul"> <li class="li">Before migration, check for missing drivers to prevent the new instances from failing to start.</li> <li class="li">This template uses image snapshots for migration. To keep all data, set <font color='blue'>Create incremental snapshots for stopped instances</font> to Yes. If you do not need to keep data generated during the migration, set it to No. <font color='red'>Set it to No first to test if the new instances work correctly. After you confirm the new instances are working, run the template again with the setting as Yes to ensure complete data integrity.</font></li> <li class="li">Creating a snapshot takes several minutes, depending on the disk size. The first snapshot of a disk is a full snapshot and can take a long time, possibly hours. Subsequent snapshots are faster but still depend on the amount of data changed since the last snapshot. More changes mean a longer creation time.</li> <li class="li"><font color='red'>The instances will restart. Ensure that data disks are set to automatically attach. Otherwise, the data disks will not be attached after the restart.</font></li> <li class="li"><font color='red'>This is a risky operation. If you set "Create incremental snapshots for stopped instances" to Yes, confirm that the business impact of stopping the instances is acceptable.</font></li> <li class="li"><font color='red'>You must manually re-attach public IP addresses and Elastic IP Addresses (EIPs) to the new instances. For more information, see <a href='https://www.alibabacloud.com/help/document_detail/156287.html'>Convert the public IP address of a classic network ECS instance to an EIP</a>, <a href='https://www.alibabacloud.com/help/document_detail/67455.html'>Convert the static public IP address of a VPC ECS instance to an EIP</a>, and <a href='https://www.alibabacloud.com/help/document_detail/27733.html'>Modify a private IP address</a>.</font></li> <li class="li">Creating a snapshot of the instances before running the template greatly reduces the running time.</li> <li class="li"><font color='red'>Ensure your account balance is sufficient to cover the cost of the new instances.</font></li> </ul>
  zh-cn: <p class="p">Clones Elastic Compute Service (ECS) instances in batches. Note:</p> <ul class="ul"> <li class="li">Before migration, check for missing drivers to prevent the new instances from failing to start.</li> <li class="li">This template uses image snapshots for migration. To keep all data, set <font color='blue'>Create incremental snapshots for stopped instances</font> to Yes. If you do not need to keep data generated during the migration, set it to No. <font color='red'>Set it to No first to test if the new instances work correctly. After you confirm the new instances are working, run the template again with the setting as Yes to ensure complete data integrity.</font></li> <li class="li">Creating a snapshot takes several minutes, depending on the disk size. The first snapshot of a disk is a full snapshot and can take a long time, possibly hours. Subsequent snapshots are faster but still depend on the amount of data changed since the last snapshot. More changes mean a longer creation time.</li> <li class="li"><font color='red'>The instances will restart. Ensure that data disks are set to automatically attach. Otherwise, the data disks will not be attached after the restart.</font></li> <li class="li"><font color='red'>This is a risky operation. If you set "Create incremental snapshots for stopped instances" to Yes, confirm that the business impact of stopping the instances is acceptable.</font></li> <li class="li"><font color='red'>You must manually re-attach public IP addresses and Elastic IP Addresses (EIPs) to the new instances. For more information, see <a href='https://www.alibabacloud.com/help/document_detail/156287.html'>Convert the public IP address of a classic network ECS instance to an EIP</a>, <a href='https://www.alibabacloud.com/help/document_detail/67455.html'>Convert the static public IP address of a VPC ECS instance to an EIP</a>, and <a href='https://www.alibabacloud.com/help/document_detail/27733.html'>Modify a private IP address</a>.</font></li> <li class="li">Creating a snapshot of the instances before running the template greatly reduces the running time.</li> <li class="li"><font color='red'>Ensure your account balance is sufficient to cover the cost of the new instances.</font></li> </ul>
  name-en: ACS-ECS-BulkyCloneInstances
  name-zh-cn: Clone ECS instances in batches
  categories:
    - cross_region
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: The region of the ECS instances to clone.
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceIds:
    Label:
      en: InstanceIds
      zh-cn: The ECS instances to clone.
    Type: List
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  targetZoneId:
    Label:
      en: TargetZoneId
      zh-cn: The zone.
    Description:
      en: For more information about purchasing instances, see the ECS purchase page: https://ecs-buy.alibabacloud.com/
      zh-cn: For more information about purchasing instances, see the ECS purchase page: https://ecs-buy.alibabacloud.com/
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      RegionId: regionId
  targetInstanceChargeType:
    Label:
      en: TargetInstanceChargeType
      zh-cn: The billing method.
    Type: String
    AssociationProperty: ChargeType
  targetPeriodUnit:
    Label:
      en: The unit of the subscription period
      zh-cn: The unit of the subscription duration.
    Type: String
    AssociationPropertyMetadata:
      Visible:
        Condition:
          'Fn::Not':
            'Fn::Equals':
              - '${targetInstanceChargeType}'
              - PostPaid
    AllowedValues:
      - Week
      - Month
    Default: Month
  targetPeriod:
    Label:
      en: TargetPeriod
      zh-cn: The subscription duration.
    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: "Valid values:
          When PeriodUnit is Week, valid values for Period are: 1, 2, 3, 4.
          When PeriodUnit is Month, valid values for Period are: 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: The instance type.
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      RegionId: regionId
      ZoneId: targetZoneId
      InstanceChargeType: targetInstanceChargeType
  targetVPCId:
    Label:
      en: TargetVPCId
      zh-cn: The virtual private cloud (VPC).
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    AssociationPropertyMetadata:
      RegionId: regionId
  targetVSwitchId:
    Label:
      en: TargetVSwitchId
      zh-cn: The vSwitch.
    Description:
      en: Confirm that the vSwitch is in the selected zone. If not, reselect or create a new vSwitch.
      zh-cn: Confirm that the vSwitch is in the selected zone. If not, reselect or create a new vSwitch.
    Type: String
    AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      RegionId: regionId
      ZoneId: targetZoneId
      VpcId: targetVPCId
  targetSecurityGroupIds:
    Label:
      en: TargetSecurityGroupIds
      zh-cn: The security group.
    Description:
      en: The vSwitch and the security group must belong to the same VPC.
      zh-cn: The security group and the vSwitch must be in the same VPC.
    Type: List
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    AssociationPropertyMetadata:
      RegionId: regionId
      VpcId: targetVPCId
  targetSystemDiskCategory:
    Label:
      en: TargetSystemDiskCategory
      zh-cn: The category of the system disk.
    Type: String
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      RegionId: regionId
      ZoneId: targetZoneId
      InstanceType: targetInstanceType
      InstanceChargeType: targetInstanceChargeType
  targetDataDiskCategory:
    Label:
      en: TargetDataDiskCategory
      zh-cn: The category of the data disk.
    Type: String
    AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
    AssociationPropertyMetadata:
      RegionId: regionId
      ZoneId: targetZoneId
      InstanceType: targetInstanceType
      InstanceChargeType: targetInstanceChargeType
  targetPassword:
    Label:
      en: TargetPassword
      zh-cn: The instance password.
    Description:
      en: "<font color='red'>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.</font>Special characters include the following: ()`~!@#$%^&*-_+=|{}[]:;''<>,.?/  Passwords of Windows instances cannot start with a forward slash (/)."
      zh-cn: "<font color='red'>The password must be 8 to 30 characters long and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.</font> Special characters can be: ()`~!@#$%^&*-_+=|{}[]:;'<>,.?/. The password of a Windows instance cannot start with a forward slash (/)."
    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 maximum data consistency, the system stops the source instance (in a stopped but billing state) after the full snapshot is created. Then, it creates an incremental snapshot, creates the destination instance from the incremental snapshot, and starts the destination instance. <font color='red'>If the task succeeds, the source instance remains stopped. Manually release the source instance as soon as possible after you verify that the destination instance is working correctly to avoid further charges.</font> If the task fails, the source instance is restarted.</li> <li class="li">If you select No (the default), to ensure the source instance is always available, the system creates and starts the destination instance from the full snapshot. <font color='red'>However, incremental data generated after the task starts is not synchronized to the destination instance. This may cause data inconsistency.</font></li></ul>
      zh-cn: <p class="p">Note:</p><ul class="ul"> <li class="li">If you select Yes, to ensure maximum data consistency, the system stops the source instance (in a stopped but billing state) after the full snapshot is created. Then, it creates an incremental snapshot, creates the destination instance from the incremental snapshot, and starts the destination instance. <font color='red'>If the task succeeds, the source instance remains stopped. Manually release the source instance as soon as possible after you verify that the destination instance is working correctly to avoid further charges.</font> If the task fails, the source instance is restarted.</li> <li class="li">If you select No (the default), to ensure the source instance is always available, the system creates and starts the destination instance from the full snapshot. <font color='red'>However, incremental data generated after the task starts is not synchronized to the destination instance. This may cause data inconsistency.</font></li></ul>
    Label:
      en: Create incremental snapshots for stopped instances
      zh-cn: Create incremental snapshots for stopped instances
    Default: false
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role that OOS assumes.
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: cloneInstances
    Action: ACS::ECS::CloneInstance
    Description:
      en: Clone ECS instances
      zh-cn: Clone ECS instances
    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 using incremental snapshots
      zh-cn: Clone ECS instances using incremental snapshots
    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: Select Instances
            en: Select Instances
      - Parameters:
          - targetZoneId
          - targetInstanceChargeType
          - targetPeriodUnit
          - targetPeriod
          - targetInstanceType
          - targetVPCId
          - targetVSwitchId
          - targetSecurityGroupIds
          - targetSystemDiskCategory
          - targetDataDiskCategory
          - targetPassword
        Label:
          default:
            zh-cn: Configure Parameters
            en: Configure Parameters
      - Parameters:
          - useIncrementSnapshot
        Label:
          default:
            en: Incremental Snapshot Option
            zh-cn: Incremental Snapshot Option
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Advanced Options