Nama templat
ACS-ECS-BulkyCloneInstances: Klon instans ECS secara batch
Deskripsi
Klon instans ECS secara batch menggunakan snapshot image. Catatan:
-
Sebelum migrasi, periksa driver yang hilang untuk mencegah instans baru gagal start.
-
Untuk mempertahankan semua data, atur Create incremental snapshots for stopped instances ke Yes. Jika Anda tidak memerlukan data yang dihasilkan selama migrasi, atur ke No. Lakukan pengujian terlebih dahulu dengan nilai No; setelah memastikan instans baru berfungsi dengan benar, jalankan kembali templat dengan nilai Yes untuk menjamin integritas data yang lengkap.
-
Waktu pembuatan snapshot bergantung pada ukuran disk. Snapshot lengkap pertama dapat memakan waktu beberapa jam, sedangkan snapshot inkremental berikutnya lebih cepat, meskipun tetap bergantung pada jumlah data yang berubah sejak snapshot terakhir.
-
Instans akan restart selama proses ini. Pastikan disk data dikonfigurasi agar auto-attach; jika tidak, disk data tidak akan tersambung setelah restart.
-
Operasi ini berisiko. Jika Anda melakukan migrasi snapshot shutdown, pastikan dampak bisnisnya dapat dikelola.
-
Anda harus secara manual menyambungkan kembali Alamat IP publik dan Elastic IP Addresses (EIPs) ke instans baru: 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, dan Primary private IP address.
-
Membuat snapshot sebelum menjalankan templat dapat mengurangi waktu eksekusi secara signifikan.
-
Pastikan saldo akun mencukupi untuk menutupi biaya instans baru.
Jenis templat
Automation
Pemilik
Alibaba Cloud
Parameter input
|
Nama parameter |
Deskripsi |
Tipe |
Wajib |
Nilai default |
Batasan |
|
instanceIds |
Instans ECS yang akan diklon. |
List |
Yes |
||
|
targetZoneId |
Zona target untuk instans yang diklon. |
String |
Yes |
||
|
targetInstanceChargeType |
Metode penagihan untuk instans baru. |
String |
Yes |
||
|
targetInstanceType |
Tipe instans untuk instans yang diklon. |
String |
Yes |
||
|
targetVPCId |
VPC target. |
String |
Yes |
||
|
targetVSwitchId |
vSwitch target. |
String |
Yes |
||
|
targetSecurityGroupIds |
Security group target. |
List |
Yes |
||
|
targetSystemDiskCategory |
Kategori sistem disk. |
String |
Yes |
||
|
targetDataDiskCategory |
Kategori data disk. |
String |
Yes |
||
|
targetPassword |
Password login untuk instans baru. |
String |
Yes |
Ekspresi reguler validasi string: [0-9A-Za-z_-&:;’<>,=%`~!@#()$^*+|{}[].?/]+$ Panjang maksimum: 30 Panjang minimum: 8| |
|
|
regionId |
Wilayah instans ECS sumber. |
String |
No |
{{ ACS::RegionId }} |
|
|
targetPeriodUnit |
Unit durasi langganan. |
String |
No |
Month |
|
|
targetPeriod |
Durasi langganan. |
Number |
No |
1 |
|
|
useIncrementSnapshot |
Apakah akan membuat snapshot inkremental untuk instans yang dihentikan. |
Boolean |
No |
False |
|
|
OOSAssumeRole |
Peran RAM yang diasumsikan oleh OOS. |
String |
No |
“” |
Parameter output
|
Nama parameter |
Deskripsi |
Tipe |
|
instanceIds |
List |
Izin yang diperlukan untuk menjalankan templat ini
{
"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"
}
]
}
Detail
Detail ACS-ECS-BulkyCloneInstances
Konten templat
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