模板名称
ACS-ECS-ScheduleToRebootInstancesWithSLR 定时重启ECS实例
模板描述
定时重启ECS实例
模板类型
自动化
所有者
Alibaba Cloud
输入参数
参数名称 | 描述 | 类型 | 是否必填 | 默认值 | 约束 |
timerTrigger | 定时类型 | Json | 是 | ||
targets | 目标实例 | Json | 是 | ||
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
rateControl | 任务执行的并发比率 | Json | 否 | {‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | AliyunServiceRoleForOOSInstanceScheduler |
输出参数
参数名称 | 描述 | 类型 |
instanceIds | List |
执行此模板需要的权限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:RebootInstance"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
详情
ACS-ECS-ScheduleToRebootInstancesWithSLR详情
模板内容
FormatVersion: OOS-2019-06-01
Description:
en: Schedule to reboots the ECS instances
zh-cn: 定时重启ECS实例
name-en: ACS-ECS-ScheduleToRebootInstancesWithSLR
name-zh-cn: 定时重启ECS实例
categories:
- time_trigger
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
timerTrigger:
Type: Json
Label:
en: TimerTrigger
zh-cn: 定时类型
AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
AssociationPropertyMetadata:
MinuteInterval: 30
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: AliyunServiceRoleForOOSInstanceScheduler
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers a task as scheduled by specifying type and expression
zh-cn: 通过指定触发类型和表达式按计划触发任务
Properties:
Type:
Fn::Select:
- type
- '{{timerTrigger}}'
Expression:
Fn::Select:
- expression
- '{{timerTrigger}}'
EndDate:
Fn::Select:
- endDate
- '{{ timerTrigger }}'
TimeZone:
Fn::Select:
- timeZone
- '{{ timerTrigger }}'
- 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: rebootInstance
Action: ACS::ECS::RebootInstance
Description:
en: Restarts the ECS instances
zh-cn: 重启实例
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:
zh-cn: 定时设置
en: Timer Trigger Configure
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: 选择实例
en: Select ECS Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: 高级选项
en: Control Options
文档内容是否对您有帮助?