ACS-ECS-BulkyCloneInstances
模板名稱
ACS-ECS-BulkyCloneInstances 批量克隆ECS實(shí)例
模板描述
批量克隆ECS實(shí)例。注意:
您在遷移之前請檢查是否缺少驅(qū)動,以免造成新的實(shí)例無法啟動。
基于鏡像快照遷移,如果需要保留完整數(shù)據(jù),請選擇停機(jī)增量快照為是,再執(zhí)行下一步操作;如果不需要保留遷移過程中產(chǎn)生的數(shù)據(jù),則選擇否,直接根據(jù)指引遷移即可。建議您先選擇否來測試新實(shí)例是否業(yè)務(wù)正常,測試新實(shí)例業(yè)務(wù)正常后再選擇是來保證完整數(shù)據(jù)。
創(chuàng)建快照的所需時間為分鐘級別,并取決于云盤容量大小。云盤的第一份快照為全量快照,耗時較久,有可能在小時級別。再次創(chuàng)建快照,相對耗時較短,但依然取決于和上一份快照之間的數(shù)據(jù)變化量。變化越大,耗時越久。
因機(jī)器會重新啟動,請您務(wù)必確認(rèn)數(shù)據(jù)盤等已設(shè)置為自動掛載否則重啟后將無法掛載數(shù)據(jù)盤。
當(dāng)前操作為高風(fēng)險操作,如果選擇停機(jī)快照遷移為是,請您確認(rèn)關(guān)機(jī)業(yè)務(wù)影響可控。
公網(wǎng)IP和彈性IP需要您手動重新綁定到新實(shí)例上,參考文檔:經(jīng)典網(wǎng)絡(luò)類型ECS固定公網(wǎng)IP轉(zhuǎn)為彈性公網(wǎng)IP、專有網(wǎng)絡(luò)ECS實(shí)例的固定公網(wǎng)IP轉(zhuǎn)換為EIP、修改私有IP地址
執(zhí)行前先打?qū)?shí)例打一個快照,將極大縮短執(zhí)行時間。
請確保您的賬號余額大于新購實(shí)例的費(fèi)用。
模板類型
自動化
所有者
Alibaba Cloud
輸入?yún)?shù)
參數(shù)名稱 | 描述 | 類型 | 是否必填 | 默認(rèn)值 | 約束 |
instanceIds | 將要克隆的ECS實(shí)例 | List | 是 | ||
targetZoneId | 可用區(qū) | String | 是 | ||
targetInstanceChargeType | 付費(fèi)方式 | String | 是 | ||
targetInstanceType | 資源規(guī)格 | String | 是 | ||
targetVPCId | 專有網(wǎng)絡(luò) | String | 是 | ||
targetVSwitchId | 虛擬交換機(jī) | String | 是 | ||
targetSecurityGroupIds | 安全組 | List | 是 | ||
targetSystemDiskCategory | 系統(tǒng)盤的種類 | String | 是 | ||
targetDataDiskCategory | 數(shù)據(jù)盤的種類 | String | 是 | ||
targetPassword | 實(shí)例密碼 | String | 是 | 字符串校驗(yàn)正則表達(dá)式 : [0-9A-Za-z_-&:;’<>,=%`~!@#()$^*+|{}[].?/]+$ 最大長度 : 30 最小長度 : 8| | |
regionId | 將要克隆的ECS實(shí)例所在地域 | String | 否 | {{ ACS::RegionId }} | |
targetPeriodUnit | 包年包月計(jì)費(fèi)方式的時長單位 | String | 否 | Month | |
targetPeriod | 購買包年包月資源的時長 | Number | 否 | 1 | |
useIncrementSnapshot | 停機(jī)增量快照 | Boolean | 否 | False | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | “” |
輸出參數(shù)
參數(shù)名稱 | 描述 | 類型 |
instanceIds | List |
執(zhí)行此模板需要的權(quán)限策略
{
"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"
}
]
}
詳情
模板內(nèi)容
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 For 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, otherwise 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='http://bestwisewords.com/document_detail/156287.html'>Classic network type ECS public IP is converted to elastic public IP</a>, <a href='http://bestwisewords.com/document_detail/67455.html'>Convert the fixed public IP of the VPC ECS instance to EIP</a>, <a href='http://bestwisewords.com/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: <p class="p">批量克隆ECS實(shí)例。注意:</p> <ul class="ul"> <li class="li">您在遷移之前請檢查是否缺少驅(qū)動,以免造成新的實(shí)例無法啟動。</li> <li class="li">基于鏡像快照遷移,如果需要保留完整數(shù)據(jù),請選擇<font color='blue'>停機(jī)增量快照</font>為是,再執(zhí)行下一步操作;如果不需要保留遷移過程中產(chǎn)生的數(shù)據(jù),則選擇否,直接根據(jù)指引遷移即可。<font color='red'>建議您先選擇否來測試新實(shí)例是否業(yè)務(wù)正常,測試新實(shí)例業(yè)務(wù)正常后再選擇是來保證完整數(shù)據(jù)。</font></li> <li class="li">創(chuàng)建快照的所需時間為分鐘級別,并取決于云盤容量大小。云盤的第一份快照為全量快照,耗時較久,有可能在小時級別。再次創(chuàng)建快照,相對耗時較短,但依然取決于和上一份快照之間的數(shù)據(jù)變化量。變化越大,耗時越久。</li> <li class="li"><font color='red'>因機(jī)器會重新啟動,請您務(wù)必確認(rèn)數(shù)據(jù)盤等已設(shè)置為自動掛載否則重啟后將無法掛載數(shù)據(jù)盤。</font></li> <li class="li"><font color='red'>當(dāng)前操作為高風(fēng)險操作,如果選擇停機(jī)快照遷移為是,請您確認(rèn)關(guān)機(jī)業(yè)務(wù)影響可控。</font></li> <li class="li"><font color='red'>公網(wǎng)IP和彈性IP需要您手動重新綁定到新實(shí)例上,參考文檔: <a href='http://bestwisewords.com/document_detail/156287.html'>經(jīng)典網(wǎng)絡(luò)類型ECS公網(wǎng)IP轉(zhuǎn)為彈性公網(wǎng)IP</a>、 <a href='http://bestwisewords.com/document_detail/67455.html'>專有網(wǎng)絡(luò)ECS實(shí)例的固定公網(wǎng)IP轉(zhuǎn)換為EIP</a>、 <a href='http://bestwisewords.com/document_detail/27733.html'>修改私有IP地址</a></font></li> <li class="li">執(zhí)行前先打?qū)?shí)例打一個快照,將極大縮短執(zhí)行時間。</li> <li class="li"><font color='red'>請確保您的賬號余額大于新購實(shí)例的費(fèi)用。</font></li> </ul>
name-en: ACS-ECS-BulkyCloneInstances
name-zh-cn: 批量克隆ECS實(shí)例
categories:
- cross_region
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 將要克隆的ECS實(shí)例所在地域
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
instanceIds:
Label:
en: InstanceIds
zh-cn: 將要克隆的ECS實(shí)例
Type: List
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
targetZoneId:
Label:
en: TargetZoneId
zh-cn: 可用區(qū)
Description:
en: For more instance purchase information, please refer to the ECS purchase page
zh-cn: 更多實(shí)例購買信息請查看ECS購買頁:https://ecs-buy.aliyun.com/
Type: String
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AssociationPropertyMetadata:
RegionId: regionId
targetInstanceChargeType:
Label:
en: TargetInstanceChargeType
zh-cn: 付費(fèi)方式
Type: String
AssociationProperty: ChargeType
targetPeriodUnit:
Label:
en: The unit of the subscription period
zh-cn: 包年包月計(jì)費(fèi)方式的時長單位
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時,Period取值:{“1”, “2”, “3”, “4”}。
PeriodUnit=Month時,Period取值:{“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: 資源規(guī)格
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
RegionId: regionId
ZoneId: targetZoneId
InstanceChargeType: targetInstanceChargeType
targetVPCId:
Label:
en: TargetVPCId
zh-cn: 專有網(wǎng)絡(luò)
Type: String
AssociationProperty: ALIYUN::ECS::VPC::VPCId
AssociationPropertyMetadata:
RegionId: regionId
targetVSwitchId:
Label:
en: TargetVSwitchId
zh-cn: 虛擬交換機(jī)
Description:
en: Please confirm whether the switch is in the selected zone. If not, please reselect or create a new switch
zh-cn: 請確認(rèn)交換機(jī)是否在所選可用區(qū)內(nèi),若不在請重新選擇或新建交換機(jī)
Type: String
AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
AssociationPropertyMetadata:
RegionId: regionId
ZoneId: targetZoneId
VpcId: targetVPCId
targetSecurityGroupIds:
Label:
en: TargetSecurityGroupIds
zh-cn: 安全組
Description:
en: The vSwitch and the security group must belong to the same VPC
zh-cn: 安全組和虛擬交換機(jī)必須在同一個專有網(wǎng)絡(luò)VPC中
Type: List
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
AssociationPropertyMetadata:
RegionId: regionId
VpcId: targetVPCId
targetSystemDiskCategory:
Label:
en: TargetSystemDiskCategory
zh-cn: 系統(tǒng)盤的種類
Type: String
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
RegionId: regionId
ZoneId: targetZoneId
InstanceType: targetInstanceType
InstanceChargeType: targetInstanceChargeType
targetDataDiskCategory:
Label:
en: TargetDataDiskCategory
zh-cn: 數(shù)據(jù)盤的種類
Type: String
AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
AssociationPropertyMetadata:
RegionId: regionId
ZoneId: targetZoneId
InstanceType: targetInstanceType
InstanceChargeType: targetInstanceChargeType
targetPassword:
Label:
en: TargetPassword
zh-cn: 實(shí)例密碼
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: ()`~!@#$%^&*-_+=|{}[]:;''<>,.?/ Passwords of Windows instances cannot start with a forward slash (/)."
zh-cn: <font color='red'><b>長度為8至30個字符,必須同時包含大小寫英文字母、數(shù)字和特殊符號中的三類字符。</b></font>特殊符號可以是: ()`~!@#$%^&*-_+=|{}[]:;'<>,.?/ ,其中,Windows實(shí)例不能以正斜線(/)為密碼首字符
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, in order 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), in order 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: <p class="p">注意:</p><ul class="ul"> <li class="li">如果選是,為了最大程度保證數(shù)據(jù)一致性,系統(tǒng)將在全量快照后,停止源實(shí)例(停機(jī)收費(fèi)模式),創(chuàng)建增量快照,基于增量快照創(chuàng)建目的實(shí)例并啟動運(yùn)行。<font color='red'>如任務(wù)執(zhí)行成功,源實(shí)例將一直保持停機(jī)狀態(tài),您可在驗(yàn)證目的實(shí)例業(yè)務(wù)正常后盡快手動釋放,避免重復(fù)收費(fèi)。</font>如任務(wù)失敗,則重新啟動源實(shí)例。</li> <li class="li">如果選否(默認(rèn)為否),為了保證源機(jī)器一直可用,系統(tǒng)將在全量快照后,基于全量快照創(chuàng)建目的實(shí)例并啟動運(yùn)行。<font color='red'>但任務(wù)啟動后的增量數(shù)據(jù)將無法同步到目的實(shí)例中,可能會造成數(shù)據(jù)不一致,請知曉。</font></li></ul>
Label:
en: IncrementSnapshot
zh-cn: 停機(jī)增量快照
Default: false
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: cloneInstances
Action: ACS::ECS::CloneInstance
Description:
en: Clone ECS instances
zh-cn: 克隆ECS實(shí)例
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實(shí)例
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: 選擇實(shí)例
en: Select Instances
- Parameters:
- targetZoneId
- targetInstanceChargeType
- targetPeriodUnit
- targetPeriod
- targetInstanceType
- targetVPCId
- targetVSwitchId
- targetSecurityGroupIds
- targetSystemDiskCategory
- targetDataDiskCategory
- targetPassword
Label:
default:
zh-cn: 配置參數(shù)
en: Configure Parameters
- Parameters:
- useIncrementSnapshot
Label:
default:
en: IncrementSnapshot
zh-cn: 停機(jī)增量快照選項(xiàng)
- Parameters:
- OOSAssumeRole
Label:
default:
zh-cn: 高級選項(xiàng)
en: Control Options