Template name
ACS-ECS-ScheduleToRebootInstancesWithSLR
Template description
Restarts Elastic Compute Service (ECS) instances as scheduled.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
timerTrigger | The type of the scheduled task. | Json | Yes | ||
targets | Target instance | Json | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
rateControl | Task execution concurrency | Json | No | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS). | String | No | AliyunServiceRoleForOOSInstanceScheduler |
Output parameters
Parameter | Description | Type |
instanceIds | List |
Permission policy that is 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-ScheduleToRebootInstancesWithSLR
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Schedules the restart of ECS instances.
name-en: ACS-ECS-ScheduleToRebootInstancesWithSLR
categories:
- time_trigger
Parameters:
regionId:
Type: String
Label:
en: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
timerTrigger:
Type: Json
Label:
en: Timer Trigger
AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
AssociationPropertyMetadata:
MinuteInterval: 30
targets:
Type: Json
Label:
en: Target Instance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
rateControl:
Label:
en: Rate Control
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOS Assume Role
Type: String
Default: AliyunServiceRoleForOOSInstanceScheduler
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers a task on a schedule based on the specified type and expression.
Properties:
Type:
Fn::Select:
- type
- '{{timerTrigger}}'
Expression:
Fn::Select:
- expression
- '{{timerTrigger}}'
StartDate:
Fn::Select:
- startDate
- '{{ timerTrigger }}'
EndDate:
Fn::Select:
- endDate
- '{{ timerTrigger }}'
TimeZone:
Fn::Select:
- timeZone
- '{{ timerTrigger }}'
- Name: getInstance
Description:
en: Retrieves the specified 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.
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
Loop:
Items: '{{ getInstance.instanceIds }}'
RateControl: '{{ rateControl }}'
Outputs:
instanceIds:
Type: List
Value: '{{ getInstance.instanceIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- timerTrigger
Label:
default:
en: Timer Trigger Settings
- Parameters:
- regionId
- targets
Label:
default:
en: Instance Selection
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
en: Advanced Options