Todos os produtos
Search
Central de documentação

CloudOps Orchestration Service:ACS-ECS-ScheduleToAcceptInquiredSystemEvent

Última atualização: Jun 28, 2026

Nome do modelo

ACS-ECS-ScheduleToAcceptInquiredSystemEvent: aceita periodicamente eventos de sistema ECS pendentes e autoriza sua execução.

Executar agora

Descrição do modelo

Este modelo aceita a operação padrão de um evento de sistema e autoriza o sistema a executá-la conforme agendado. Procedimento:

  1. Parar uma instância do Elastic Compute Service (ECS).

  2. Aceitar a operação padrão do evento de sistema e autorizar o sistema a executá-la.

  3. Iniciar a instância ECS.

Tipo de modelo

Automatizado

Proprietário

Alibaba Cloud

Parâmetros de entrada

Parâmetro

Descrição

Tipo

Obrigatório

Valor padrão

Limite

timerTrigger

Tipo da tarefa agendada.

Json

Sim

instanceId

ID da instância ECS.

String

Sim

eventId

ID do evento de sistema.

String

Sim

regionId

ID da região.

String

Não

{{ ACS::RegionId }}

OOSAssumeRole

Função RAM assumida pelo CloudOps Orchestration Service (OOS).

String

Não

AliyunServiceRoleForOOSSystemEventOperator

Parâmetros de saída

Nenhum

Política de permissões necessária para executar o modelo

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:AcceptInquiredSystemEvent",
                "ecs:DescribeInstances",
                "ecs:StartInstance",
                "ecs:StopInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Detalhes

Para obter mais informações, consulte ACS-ECS-ScheduleToAcceptInquiredSystemEvent.yml no GitHub.

Conteúdo do modelo

FormatVersion: OOS-2019-06-01
Description:
  en: <p>Schedules the acceptance of a system event and authorizes its execution. The process is as follows: <ol><li>Stops the ECS instance.</li><li>Accepts the inquired system event.</li><li>Starts the ECS instance.</li</ol></p>
  zh-cn: <p>Schedules the acceptance of a system event and authorizes its execution. The process is as follows: <ol><li>Stops the ECS instance.</li><li>Accepts the inquired system event.</li><li>Starts the ECS instance.</li</ol></p>
  name-en: ACS-ECS-ScheduleToAcceptInquiredSystemEvent
  name-zh-cn: Schedules the acceptance of a system event and authorizes its execution.
  categories:
    - time_trigger
Parameters:
  timerTrigger:
    Type: Json
    Label:
      en: TimerTrigger
      zh-cn: Timer type
    AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
    AssociationPropertyMetadata:
      MinuteInterval: 30
  regionId:
    Label:
      en: RegionId
      zh-cn: Region ID
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceId:
    Label:
      en: ECSInstanceId
      zh-cn: ECS instance ID
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  eventId:
    Label:
      en: EventId
      zh-cn: System event ID
    Type: String
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role that is assumed by OOS.
    Type: String
    Default: AliyunServiceRoleForOOSSystemEventOperator
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: timerTrigger
    Action: ACS::TimerTrigger
    Description:
      en: Triggers a task as scheduled by specifying type and expression.
      zh-cn: Triggers a task as scheduled by specifying the 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
    Action: ACS::SelectTargets
    Description:
      en: Obtains the ECS instance.
      zh-cn: Obtains the ECS instance.
    Properties:
      ResourceType: ALIYUN::ECS::Instance
      RegionId: '{{ regionId }}'
      Filters:
        - Type: ResourceIds
          RegionId: '{{ regionId }}'
          ResourceIds:
            - '{{ instanceId }}'
    Outputs:
      instanceId:
        Type: String
        ValueSelector: Instances.Instance[].InstanceId
      status:
        Type: String
        ValueSelector: Instances.Instance[].Status
  - Name: checkForWhetherResourceExist
    Action: ACS::Choice
    Description:
      en: Checks whether the resource exists.
      zh-cn: Checks whether the resource exists.
    Properties:
      DefaultTask: stopInstance
      Choices:
        - When:
            Fn::Equals:
              - Null
              - '{{ getInstance.instanceId }}'
          NextTask: ACS::END
  - Name: stopInstance
    Action: ACS::ECS::StopInstance
    Description:
      en: Stops the ECS instance.
      zh-cn: Stops the ECS instance.
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ getInstance.instanceId }}'
  - Name: acceptInquiredSystemEvent
    Action: ACS::ExecuteApi
    Description:
      en: Accepts and authorizes system event actions.
      zh-cn: Accepts and authorizes system event actions.
    Properties:
      Service: ECS
      API: AcceptInquiredSystemEvent
      Parameters:
        RegionId: '{{ regionId }}'
        EventId: '{{ eventId }}'
  - Name: startInstance
    Action: ACS::ECS::StartInstance
    When:
      Fn::Equals:
        - Running
        - '{{ getInstance.status }}'
    Description:
      en: Starts the ECS instance.
      zh-cn: Starts the ECS instance.
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ getInstance.instanceId }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - timerTrigger
        Label:
          default:
            zh-cn: Timer Settings
            en: Timer Settings
      - Parameters:
          - regionId
          - instanceId
          - eventId
        Label:
          default:
            zh-cn: Select Instance
            en: Select Instance
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Advanced Options