ACS-ECS-ScheduleToRebootInstances
模板名稱
ACS-ECS-ScheduleToRebootInstances 定時(shí)重啟ECS實(shí)例
模板描述
定時(shí)重啟ECS實(shí)例,適用于需要定期管理和重啟ECS實(shí)例的場景,如系統(tǒng)維護(hù)和更新。在配置過程中,用戶需要提供以下必填參數(shù)信息:地域ID(regionId):用于指定操作實(shí)例的地域,cron表達(dá)式(cron):用于定義任務(wù)的定時(shí)觸發(fā)規(guī)則,以及目標(biāo)實(shí)例(targets):用于定義具體需要操作的ECS實(shí)例。模板在執(zhí)行后會根據(jù)設(shè)置的時(shí)間表定期重啟ECS實(shí)例。
模板類型
自動化
所有者
Alibaba Cloud
輸入?yún)?shù)
參數(shù)名稱 | 描述 | 類型 | 是否必填 | 默認(rèn)值 | 約束 |
endDate | 時(shí)間觸發(fā)器結(jié)束時(shí)間 | String | 是 | ||
targets | 目標(biāo)實(shí)例 | Json | 是 | ||
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
cron | cron表達(dá)式 | String | 否 | 0 0 12 ? * * | |
timeZone | 時(shí)區(qū) | String | 否 | UTC | |
rateControl | 任務(wù)執(zhí)行的并發(fā)比率 | Json | 否 | {‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | AliyunServiceRoleForOOSInstanceScheduler |
輸出參數(shù)
參數(shù)名稱 | 描述 | 類型 |
instanceIds | List |
執(zhí)行此模板需要的權(quán)限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:RebootInstance"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
ACS-ECS-ScheduleToRebootInstances詳情
模板內(nèi)容
FormatVersion: OOS-2019-06-01
Description:
en: 'Schedule to reboot ECS instances, applicable to scenarios that require periodic management and reboot of ECS instances, such as system maintenance and updates. During configuration, users need to provide the following required parameter information: Region ID (regionId), which specifies the region of the ECS instances to be operated on, Cron Expression (cron), which defines the schedule for the task, and Target Instances (targets), which defines the specific ECS instances to be operated on. Upon execution, the template will periodically reboot the ECS instances according to the configured schedule.'
zh-cn: 定時(shí)重啟ECS實(shí)例,適用于需要定期管理和重啟ECS實(shí)例的場景,如系統(tǒng)維護(hù)和更新。在配置過程中,用戶需要提供以下必填參數(shù)信息:地域ID(regionId):用于指定操作實(shí)例的地域,cron表達(dá)式(cron):用于定義任務(wù)的定時(shí)觸發(fā)規(guī)則,以及目標(biāo)實(shí)例(targets):用于定義具體需要操作的ECS實(shí)例。模板在執(zhí)行后會根據(jù)設(shè)置的時(shí)間表定期重啟ECS實(shí)例。
name-en: ACS-ECS-ScheduleToRebootInstances
name-zh-cn: 定時(shí)重啟ECS實(shí)例
categories:
- time_trigger
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
cron:
Description:
en: 'refer them here: http://bestwisewords.com/document_detail/169784.html'
zh-cn: '詳情參考:http://bestwisewords.com/document_detail/169784.html'
Label:
en: CronExpression
zh-cn: cron表達(dá)式
Type: String
AssociationProperty: Cron
Default: 0 0 12 ? * *
endDate:
Description:
en: 'Format: yyyy-MM-ddTHH:mm:ssZ.'
zh-cn: '格式:yyyy-MM-ddTHH:mm:ssZ'
Label:
en: EndDate
zh-cn: 時(shí)間觸發(fā)器結(jié)束時(shí)間
Type: String
AssociationProperty: DateTime
AssociationPropertyMetadata:
Format: 'YYYY-MM-DDTHH:mm:ssZ'
timeZone:
Label:
en: TimeZone
zh-cn: 時(shí)區(qū)
Type: String
AssociationProperty: TimeZone
Default: UTC
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: 目標(biāo)實(shí)例
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
rateControl:
Label:
en: RateControl
zh-cn: 任務(wù)執(zhí)行的并發(fā)比率
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: 通過指定觸發(fā)類型和表達(dá)式按計(jì)劃觸發(fā)任務(wù)
Properties:
Type: cron
Expression: '{{ cron }}'
EndDate: '{{ endDate }}'
TimeZone: '{{ timeZone }}'
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: 獲取ECS實(shí)例
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: 重啟實(shí)例
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:
- timeZone
- cron
- endDate
Label:
default:
zh-cn: 定時(shí)設(shè)置
en: Timer Trigger Configure
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: 選擇實(shí)例
en: Select ECS Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: 高級選項(xiàng)
en: Control Options