Nom du modèle
ACS-ECS-BulkyCloneInstances : Cloner des instances ECS par lots
Description
Clone des instances ECS par lots en créant des snapshots d'image. Remarques :
Avant la migration, vérifiez l'absence de pilotes manquants afin d'éviter tout échec de démarrage des nouvelles instances.
Pour préserver toutes les données, définissez « Create incremental snapshots for stopped instances » sur Oui. Si vous n'avez pas besoin de conserver les données générées pendant la migration, définissez-le sur Non. Testez d'abord avec Non ; après avoir confirmé le bon fonctionnement des nouvelles instances, exécutez à nouveau le processus avec Oui pour garantir l'intégrité complète des données.
Le temps de création d'un snapshot dépend de la taille du disque. Le premier snapshot complet peut prendre plusieurs heures. Les snapshots incrémentiels sont plus rapides, mais leur durée dépend des données modifiées depuis le dernier snapshot.
Les instances redémarrent au cours de ce processus. Assurez-vous que les disques de données sont configurés pour être rattachés automatiquement ; sinon, ils ne seront pas rattachés après le redémarrage.
Il s'agit d'une opération à risque. Si vous utilisez la migration par snapshot lors de l'arrêt, confirmez que l'impact métier est acceptable.
Vous devez rattacher manuellement les adresses IP publiques et les EIP aux nouvelles instances : Convert the public IP address of a classic network ECS instance to an EIP, Convert the static public IP address of a VPC ECS instance to an EIP, et Primary private IP address.
La précréation des snapshots réduit considérablement le temps d'exécution du modèle.
Assurez-vous que le solde de votre compte est suffisant pour couvrir le coût des nouvelles instances.
Type de modèle
Automatisation
Propriétaire
Alibaba Cloud
Paramètres d'entrée
|
Nom du paramètre |
Description |
Type |
Obligatoire |
Valeur par défaut |
Contraintes |
|
instanceIds |
ID des instances ECS à cloner. |
List |
Oui |
||
|
targetZoneId |
Zone cible pour les instances clonées. |
String |
Oui |
||
|
targetInstanceChargeType |
Mode de facturation des nouvelles instances. |
String |
Oui |
||
|
targetInstanceType |
Type d'instance pour les instances clonées. |
String |
Oui |
||
|
targetVPCId |
VPC cible. |
String |
Oui |
||
|
targetVSwitchId |
vSwitch cible. |
String |
Oui |
||
|
targetSecurityGroupIds |
Groupe de sécurité cible. |
List |
Oui |
||
|
targetSystemDiskCategory |
Catégorie du disque système. |
String |
Oui |
||
|
targetDataDiskCategory |
Catégorie du disque de données. |
String |
Oui |
||
|
targetPassword |
Mot de passe de connexion pour les nouvelles instances. |
String |
Oui |
Expression régulière de validation de chaîne : [0-9A-Za-z_-&:;’<>,=%`~!@#()$^*+|{}[].?/]+$ Longueur maximale : 30 Longueur minimale : 8| |
|
|
regionId |
Région des instances ECS source. |
String |
Non |
{{ ACS::RegionId }} |
|
|
targetPeriodUnit |
Unité de la durée de l'abonnement. |
String |
Non |
Month |
|
|
targetPeriod |
Durée de l'abonnement. |
Number |
Non |
1 |
|
|
useIncrementSnapshot |
Indique s'il faut créer des snapshots incrémentiels pour les instances arrêtées. |
Boolean |
Non |
False |
|
|
OOSAssumeRole |
Rôle RAM à endosser par OOS. |
String |
Non |
“” |
Paramètres de sortie
|**Nom du paramètre**
|
**Description**
|
**Type**
| | --- | --- | --- | |
instanceIds
| |
List
|
Autorisations requises pour exécuter ce modèle
{
"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"
}
]
}
Détails
Détails de ACS-ECS-BulkyCloneInstances
Contenu du modèle
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