全部产品
Search
文档中心

CloudOps Orchestration Service:ACS-ECS-ScheduleToRebootInstancesWithSLR

更新时间:Dec 21, 2025

Nama Template

ACS-ECS-ScheduleToRebootInstancesWithSLR

Eksekusi Sekarang

Deskripsi Template

Memulai ulang instance Elastic Compute Service (ECS) sesuai jadwal.

Tipe Template

Otomatis

Pemilik

Alibaba Cloud

Parameter input

Parameter

Deskripsi

Tipe

Diperlukan

Nilai Default

Batasan

timerTrigger

Tipe tugas terjadwal.

Json

Ya

targets

Instans target

Json

Ya

regionId

ID wilayah.

String

Tidak

{{ ACS::RegionId }}

rateControl

Konkurensi eksekusi task

Json

Tidak

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10}

OOSAssumeRole

Peran Resource Access Management (RAM) yang diasumsikan oleh CloudOps Orchestration Service (OOS).

String

Tidak

AliyunServiceRoleForOOSInstanceScheduler

Parameter keluaran

Parameter

Deskripsi

Tipe

instanceIds

List

Kebijakan Izin yang Diperlukan untuk Menjalankan Template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:RebootInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Detail

Detail ACS-ECS-ScheduleToRebootInstancesWithSLR

Konten Template

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