Tous les produits
Search
Centre de documentation

CloudOps Orchestration Service:ACS-ECS-ScheduleToAcceptInquiredSystemEvent

Dernière mise à jour :Aug 11, 2026

Nom du modèle

ACS-ECS-ScheduleToAcceptInquiredSystemEvent : accepte périodiquement les événements système ECS en attente de confirmation et autorise leur exécution.

Exécuter maintenant

Description du modèle

Accepte l'opération par défaut associée à un événement système et autorise le système à l'exécuter selon la planification. Procédure :

  1. Arrêtez une instance Elastic Compute Service (ECS).

  2. Acceptez l'opération par défaut pour un événement système et autorisez le système à l'effectuer.

  3. Démarrez l'instance ECS.

Type de modèle

Automatisé

Propriétaire

Alibaba Cloud

Paramètres d'entrée

Paramètre

Description

Type

Obligatoire

Valeur par défaut

Limite

timerTrigger

Type de tâche planifiée.

Json

Oui

instanceId

ID de l'instance ECS.

String

Oui

eventId

ID d'un événement système.

String

Oui

regionId

ID de la région.

String

Non

{{ ACS::RegionId }}

OOSAssumeRole

Rôle RAM endossé par CloudOps Orchestration Service (OOS).

String

Non

AliyunServiceRoleForOOSSystemEventOperator

Paramètres de sortie

Aucun

Stratégie d'autorisation requise pour exécuter le modèle

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

Détails

Pour plus d'informations, consultez le fichier ACS-ECS-ScheduleToAcceptInquiredSystemEvent.yml sur GitHub.

Contenu du modèle

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