模板名稱
ACS-ECS-BulkyCloneInstances 批量複製ECS執行個體
模板描述
批量複製ECS執行個體。注意:
您在遷移之前請檢查是否缺少驅動,以免造成新的執行個體無法啟動。
基於鏡像快照遷移,如果需要保留完整資料,請選擇停機增量快照為是,再執行下一步操作;如果不需要保留遷移過程中產生的資料,則選擇否,直接根據指引遷移即可。建議您先選擇否來測試新執行個體是否業務正常,測試新執行個體業務正常後再選擇是來保證完整資料。
建立快照的所需時間為分鐘層級,並取決於雲端硬碟容量大小。雲端硬碟的第一份快照為全量快照,耗時較久,有可能在小時層級。再次建立快照,相對耗時較短,但依然取決於和上一份快照之間的資料變化量。變化越大,耗時越久。
因機器會重新啟動,請您務必確認資料盤等已設定為自動掛載否則重啟後將無法掛載資料盤。
當前操作為高風險操作,如果選擇停機快照遷移為是,請您確認關機業務影響可控。
公網IP和彈性IP需要您手動重新綁定到新執行個體上,參考文檔:傳統網路類型ECS固定公網IP轉為Elastic IP Address、專用網路ECS執行個體的固定公網IP轉換為EIP、修改私人IP地址
執行前先打對執行個體打一個快照,將極大縮短執行時間。
請確保您的帳號餘額大於新購執行個體的費用。
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 預設值 | 約束 |
instanceIds | 將要複製的ECS執行個體 | List | 是 | ||
targetZoneId | 可用性區域 | String | 是 | ||
targetInstanceChargeType | 付費方式 | String | 是 | ||
targetInstanceType | 資源規格 | String | 是 | ||
targetVPCId | 專用網路 | String | 是 | ||
targetVSwitchId | 虛擬交換器 | String | 是 | ||
targetSecurityGroupIds | 安全性群組 | List | 是 | ||
targetSystemDiskCategory | 系統硬碟的種類 | String | 是 | ||
targetDataDiskCategory | 資料盤的種類 | String | 是 | ||
targetPassword | 執行個體密碼 | String | 是 | 字串校正Regex : [0-9A-Za-z_-&:;’<>,=%`~!@#()$^*+|{}[].?/]+$ 最大長度 : 30 最小長度 : 8| | |
regionId | 將要複製的ECS執行個體所在地區 | String | 否 | {{ ACS::RegionId }} | |
targetPeriodUnit | 訂用帳戶計費方式的時間長度單位 | String | 否 | Month | |
targetPeriod | 購買訂用帳戶資源的時間長度 | Number | 否 | 1 | |
useIncrementSnapshot | 停機增量快照 | Boolean | 否 | False | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | “” |
輸出參數
參數名稱 | 描述 | 類型 |
instanceIds | List |
執行此模板需要的權限原則
{
"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"
}
]
}
詳情
模板內容
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='https://help.aliyun.com/document_detail/156287.html'>Classic network type ECS public IP is converted to elastic public IP</a>, <a href='https://help.aliyun.com/document_detail/67455.html'>Convert the fixed public IP of the VPC ECS instance to EIP</a>, <a href='https://help.aliyun.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執行個體。注意:</p> <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和彈性IP需要您手動重新綁定到新執行個體上,參考文檔: <a href='https://help.aliyun.com/document_detail/156287.html'>傳統網路類型ECS公網IP轉為Elastic IP Address</a>、 <a href='https://help.aliyun.com/document_detail/67455.html'>專用網路ECS執行個體的固定公網IP轉換為EIP</a>、 <a href='https://help.aliyun.com/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: 將要複製的ECS執行個體所在地區
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
instanceIds:
Label:
en: InstanceIds
zh-cn: 將要複製的ECS執行個體
Type: List
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
targetZoneId:
Label:
en: TargetZoneId
zh-cn: 可用性區域
Description:
en: For more instance purchase information, please refer to the ECS purchase page
zh-cn: 更多執行個體購買資訊請查看ECS購買頁:https://ecs-buy.aliyun.com/
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時,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: 資源規格
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
RegionId: regionId
ZoneId: targetZoneId
InstanceChargeType: targetInstanceChargeType
targetVPCId:
Label:
en: TargetVPCId
zh-cn: 專用網路
Type: String
AssociationProperty: ALIYUN::ECS::VPC::VPCId
AssociationPropertyMetadata:
RegionId: regionId
targetVSwitchId:
Label:
en: TargetVSwitchId
zh-cn: 虛擬交換器
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: 安全性群組
Description:
en: The vSwitch and the security group must belong to the same VPC
zh-cn: 安全性群組和虛擬交換器必須在同一個Virtual Private Cloud中
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: ()`~!@#$%^&*-_+=|{}[]:;''<>,.?/ Passwords of Windows instances cannot start with a forward slash (/)."
zh-cn: <font color='red'><b>長度為8至30個字元,必須同時包含大小寫英文字母、數字和特殊符號中的三類字元。</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, 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">如果選是,為了最大程度保證資料一致性,系統將在全量快照後,停止源執行個體(停機收費模式),建立增量快照,基於增量快照建立目的執行個體並啟動運行。<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扮演的RAM角色
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