模板名稱
ACS-ECS-BulkyReplaceSystemDisk 批量更換ECS執行個體的系統硬碟
模板描述
批量更換ECS執行個體的系統硬碟,適用於需要對多台ECS執行個體進行系統硬碟替換的情境,例如系統升級和故障恢複等。在配置過程中,使用者需要提供以下必填參數資訊,地區ID(regionId):用於指定更換系統硬碟的ECS執行個體所在的地區,鏡像ID(imageId):用於指定更換系統硬碟時使用的鏡像,目標執行個體(targets):用於定義具體需要操作的ECS執行個體。模板在執行後會返回新系統硬碟的ID列表,方便使用者驗證系統硬碟替換的狀態。
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 預設值 | 約束 |
imageId | 鏡像ID | String | 是 | ||
targets | 目標執行個體 | Json | 是 | ||
regionId | 地區ID | String | 否 | {{ ACS::RegionId }} | |
password | 執行個體的使用者名稱密碼 | String | 否 | "" | |
keyPairName | 金鑰組名稱 | String | 否 | "" | |
rateControl | 任務執行的並發比率 | Json | 否 | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | "" |
輸出參數
參數名稱 | 描述 | 類型 |
newSystemDiskIds | String |
執行此模板需要的權限原則
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeDisks",
"ecs:DescribeInstances",
"ecs:ReplaceSystemDisk",
"ecs:StartInstance",
"ecs:StopInstance"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
ACS-ECS-BulkyReplaceSystemDisk詳情
模板內容
FormatVersion: OOS-2019-06-01
Description:
en: 'Bulky replace the system disks of ECS instances, applicable to scenarios that require system disk replacement on multiple ECS instances, such as system upgrades and fault recovery. During configuration, users need to provide the following required parameter information: Region ID (regionId), which specifies the region of the ECS instances where the system disks will be replaced, Image ID (imageId), which specifies the image to use for the system disk replacement, and Target Instances (targets), which defines the specific ECS instances to be operated on. Upon execution, the template provides the IDs of the new system disks, enabling users to verify the status of the system disk replacements.'
zh-cn: 批量更換ECS執行個體的系統硬碟,適用於需要對多台ECS執行個體進行系統硬碟替換的情境,例如系統升級和故障恢複等。在配置過程中,使用者需要提供以下必填參數資訊,地區ID(regionId):用於指定更換系統硬碟的ECS執行個體所在的地區,鏡像ID(imageId):用於指定更換系統硬碟時使用的鏡像,目標執行個體(targets):用於定義具體需要操作的ECS執行個體。模板在執行後會返回新系統硬碟的ID列表,方便使用者驗證系統硬碟替換的狀態。
name-en: ACS-ECS-BulkyReplaceSystemDisk
name-zh-cn: 批量更換ECS執行個體的系統硬碟
categories:
- instance_manage
- application_management
- tag_operate_resource
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地區ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
imageId:
Label:
en: ImageId
zh-cn: 鏡像ID
Description:
en:
If the system disk capacity of the image you select is larger than the original system disk capacity, the system disk will be automatically expanded, which may incur additional costs.
zh-cn:
如果您選擇的鏡像的系統硬碟容量大於原系統硬碟容量,會自動對系統硬碟進行擴容,可能會產生額外費用。
Type: String
AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
AssociationPropertyMetadata:
RegionId: regionId
password:
Label:
en: Password
zh-cn: 執行個體的使用者名稱密碼
Type: String
Default: ''
keyPairName:
Label:
en: KeyPairName
zh-cn: 金鑰組名稱
Type: String
Default: ''
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: 目標執行個體
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
rateControl:
Label:
en: RateControl
zh-cn: 任務執行的並發比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: 擷取ECS執行個體
Action: 'ACS::SelectTargets'
Properties:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: replaceSystemDisk
Action: 'ACS::ECS::ReplaceSystemDisk'
Description:
en: Replaces the system disk of ECS instances
zh-cn: 更換系統硬碟
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
imageId: '{{ imageId }}'
keyPairName: '{{ keyPairName }}'
password: '{{ password }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
newSystemDiskIds:
AggregateType: 'Fn::ListJoin'
AggregateField: newSystemDiskId
Outputs:
newSystemDiskId:
Type: String
ValueSelector: newSystemDiskId
Outputs:
newSystemDiskIds:
Type: String
Value: '{{ replaceSystemDisk.newSystemDiskIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- imageId
- password
- keyPairName
Label:
default:
zh-cn: 設定參數
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: 選擇執行個體
en: Select ECS Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: 進階選項
en: Control Options