Batch initialize system disks for multiple stopped ECS instances.
Template description
Initializes the system disks of multiple Elastic Compute Service (ECS) instances that are in the Stopped state.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
|
Parameter |
Description |
Type |
Required |
Default value |
Limit |
|
targets |
The ECS instances whose system disks you want to initialize. |
Json |
Yes |
||
|
regionId |
The region ID. |
String |
No |
{{ ACS::RegionId }} |
|
|
rateControl |
The concurrency settings for task execution. |
Json |
No |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
The RAM role that CloudOps Orchestration Service (OOS) assumes to perform operations. |
String |
No |
"" |
Output parameters
|
Parameter |
Description |
Type |
|
diskIdAndInstanceIds |
List |
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeDisks",
"ecs:DescribeInstances",
"ecs:ReInitDisk",
"ecs:StartInstance",
"ecs:StopInstance"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Details
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Initializes the system disks of multiple instances in a batch. The instances must be in the Stopped state.
zh-cn: Initializes the system disks of multiple instances in a batch. The instances must be in the Stopped state.
name-en: ACS-ECS-BulkyReInitSystemDisk
name-zh-cn: Batch initialize system disks
categories:
- instance_manage
Parameters:
regionId:
Type: String
Label:
en: Region ID
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: Target instance
zh-cn: Target instance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
rateControl:
Label:
en: Rate control
zh-cn: Rate control
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOS assume role
zh-cn: OOS assume role
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Gets the ECS instances.
zh-cn: Gets the ECS instances.
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
- Name: reInitSystemDisk
Action: ACS::ECS::ReInitDisk
Description:
en: Initializes the system disk.
zh-cn: Initializes the system disk.
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.Instances.Instance[].InstanceId }}'
Outputs:
diskIdAndInstanceIds:
AggregateType: Fn::ListJoin
AggregateField: diskIdAndInstanceId
Outputs:
diskIdAndInstanceId:
Type: Json
ValueSelector: reInitDiskIdAndInstanceId
Outputs:
diskIdAndInstanceIds:
Type: List
Value: '{{ reInitSystemDisk.diskIdAndInstanceIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: Select instances
en: Select ECS instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced options
en: Advanced options