Template name
ACS-ECS-BulkyRebootInstances - Batch restarts instances
Template description
Restarts multiple ECS instances in a batch, which is useful during system updates or maintenance. You must specify the region ID (regionId) and the target instances (targets). After execution, the template returns a list of all restarted instance IDs that you can use to verify the restart status.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
|
Parameter |
Description |
Type |
Required |
Default value |
Limit |
|
targets |
Target instance |
Json |
Yes |
||
|
regionId |
The region ID. |
String |
No |
{{ ACS::RegionId }} |
|
|
forceStop |
Whether to forcibly stop the ECS instances. |
Boolean |
No |
False |
|
|
rateControl |
Task execution concurrency ratio |
Json |
No |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
The RAM role assumed by OOS. |
String |
No |
"" |
Output parameters
|
Parameter |
Description |
Type |
|
instanceIds |
List |
Permission policy required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:RebootInstance"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Details
Details of ACS-ECS-BulkyRebootInstances
Template content
FormatVersion: OOS-2019-06-01
Description:
en: 'Bulky restarts the ECS instances, applicable to scenarios that require managing and restarting multiple ECS instances simultaneously, such as system updates and maintenance. During configuration, users need to provide the following required parameter information: Region ID (regionId), which specifies the region of the ECS instances to be restarted, and Target Instances (targets), which defines the specific ECS instances to be operated on. Upon execution, the template will return a list of the restarted instance IDs, enabling users to verify the status of the instance restart operations.'
zh-cn: 'Restarts multiple ECS instances in a batch. This is useful for scenarios that require managing and restarting multiple ECS instances at the same time, such as for system updates and maintenance. During configuration, provide the following required parameters: the region ID (regionId), which specifies the region of the instances to restart, and the target instances (targets), which define the specific ECS instances for the operation. After the template runs, it returns a list of all restarted instance IDs. This helps you verify the restart status of the instances.'
name-en: Bulky Reboot Instances
name-zh-cn: Restart multiple instances in a batch
categories:
- instance_manage
- application_manage
- computenest
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: Target instance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
forceStop:
Label:
en: ForceStop
zh-cn: Force shutdown
Type: Boolean
Default: false
rateControl:
Label:
en: RateControl
zh-cn: Concurrency rate for task execution
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: RAM role assumed by OOS
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: Get ECS instances
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: rebootInstance
Action: ACS::ECS::RebootInstance
Description:
en: Restarts the ECS instances
zh-cn: Restart instances
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
forceStop: '{{ forceStop }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
instanceIds:
Type: List
Value: '{{ getInstance.instanceIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: Select instances
en: Select Ecs Instances
- Parameters:
- forceStop
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced options
en: Control Options