模板名稱
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"
}
]
}
詳情
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
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
imageId:
Label:
en: ImageId
zh-cn: 鏡像ID
Description:
en: <div style="color:#F00">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. </div>
zh-cn: <div style="color:#F00">如果您選擇的鏡像的系統盤容量大于原系統盤容量,會自動對系統盤進行擴容,可能會產生額外費用。</div>
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
文檔內容是否對您有幫助?