全部产品
Search
文档中心

CloudOps Orchestration Service:ACS-ECS-ScheduleToRebootInstances

更新时间:Dec 21, 2025

Nama Template

ACS-ECS-ScheduleToRebootInstances: Menjadwalkan restart instans ECS

Eksekusi Sekarang

Deskripsi Template

Template ini menjadwalkan restart instans Elastic Compute Service (ECS), berguna untuk tugas manajemen rutin seperti pemeliharaan sistem dan pembaruan. Saat dikonfigurasi, Anda harus menentukan ID wilayah (regionId), ekspresi cron (cron), dan instans target (targets). Template ini kemudian akan secara berkala merestart instans ECS yang ditentukan sesuai jadwal tersebut.

Tipe Template

Otomatis

Pemilik

Alibaba Cloud

Parameter Input

Parameter

Deskripsi

Tipe

Diperlukan

Nilai Default

Batasan

endDate

Waktu akhir tugas terjadwal.

String

Ya

targets

Instans sasaran

Json

Ya

regionId

ID wilayah.

String

Tidak

{{ ACS::RegionId }}

cron

Ekspresi CRON.

String

Tidak

0 0 12 ? * *

timeZone

Zona waktu.

String

Tidak

UTC

rateControl

Laju eksekusi tugas konkuren

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 mengeksekusi template

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

Detail

Untuk informasi lebih lanjut, lihat ACS-ECS-ScheduleToRebootInstances.yml di GitHub.

Konten Template

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: Schedules ECS instances for restart. This is useful for scenarios that require regular instance management, such as system maintenance and updates. During configuration, you must provide the region ID (regionId), a cron expression (cron) for the schedule, and the target instances (targets). The template then periodically restarts the specified ECS instances based on your settings.
  name-en: ACS-ECS-ScheduleToRebootInstances
  name-zh-cn: Schedule ECS instance restart
  categories:
    - time_trigger
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: Region ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  cron:
    Description:
      en: 'refer them here: https://www.alibabacloud.com/help/document_detail/169784.html'
      zh-cn: 'For more information, see: https://www.alibabacloud.com/help/document_detail/169784.html'
    Label:
      en: CronExpression
      zh-cn: Ekspresi cron
    Type: String
    AssociationProperty: Cron
    Default: 0 0 12 ? * *
  endDate:
    Description:
      en: 'Format: yyyy-MM-ddTHH:mm:ssZ.'
      zh-cn: 'Format: yyyy-MM-ddTHH:mm:ssZ'
    Label:
      en: EndDate
      zh-cn: Waktu akhir pemicu
    Type: String
    AssociationProperty: DateTime
    AssociationPropertyMetadata:
      Format: 'YYYY-MM-DDTHH:mm:ssZ'
  timeZone:
    Label:
      en: TimeZone
      zh-cn: Zona waktu
    Type: String
    AssociationProperty: TimeZone
    Default: UTC
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: Instans target
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  rateControl:
    Label:
      en: RateControl
      zh-cn: Laju konkurensi eksekusi tugas
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: Peran RAM yang diasumsikan oleh OOS
    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: Memicu tugas sesuai jadwal dengan menentukan tipe dan ekspresi.
  Properties:
    Type: cron
    Expression: '{{ cron }}'
    EndDate: '{{ endDate }}'
    TimeZone: '{{ timeZone }}'
- Name: getInstance
  Description:
    en: Views the ECS instances
    zh-cn: Mendapatkan instans ECS.
  Action: ACS::SelectTargets
  Properties:
    ResourceType: ALIYUN::ECS::Instance
    RegionId: '{{ regionId }}'
    Filters:
      - '{{ targets }}'
- Name: rebootInstance
  Action: ACS::ECS::RebootInstance
  Description:
    en: Restarts the ECS instances
    zh-cn: Merestart instans.
  Properties:
    regionId: '{{ regionId }}'
    instanceId: '{{ ACS::TaskLoopItem }}'
  Loop:
    Items: '{{ getInstance.Instances.Instance[].InstanceId }}'
    RateControl: '{{ rateControl }}'
Outputs:
  instanceIds:
    Type: List
    Value: '{{ getInstance.Instances.Instance[].InstanceId }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - timeZone
          - cron
          - endDate
        Label:
          default:
            zh-cn: Pengaturan Jadwal
            en: Timer Trigger Configure
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: Pilih Instans
            en: Select ECS Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Opsi Lanjutan
            en: Control Options