All Products
Search
Document Center

Elastic Compute Service:Instance event notifications

Last Updated:Jul 12, 2023

Elastic Compute Service (ECS) can send notifications for instance events, such as O&M events, lifecycle status change events, and preemptible instance release events.

Events

ECS can send notifications for the following instance events:

O&M events

When an O&M event occurs on an instance, ECS sends the first notification for the event, and subsequently sends a notification each time the status of the event changes. For information about the names of notifications for O&M events, see the Appendix: Notifications for instance-related O&M events section of this topic.

The following snippets of sample code provide examples of notifications in the JSON format for an Instance restart due to system maintenance (SystemMaintenance.Reboot) event.

  • Sample first notification, which indicates that the O&M event is in the Scheduled (Scheduled) state:

    {
      "id": "2256A988-0B26-4E2B-820A-8A********E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "CRITICAL",
      "name": "Instance:SystemMaintenance.Reboot:Scheduled",
      "userId": "169070********30",
      "eventTime": "20190409T121826.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
        "eventId": "e-bp11trd********pqum2",
        "publishTime": "2019-04-09T04:18:26Z",
        "notBefore": "2019-04-12T01:01:01Z",      
        "instanceId": "i-bp1ecr********5go2go",   
        "eventType": "SystemMaintenance.Reboot",  
        "eventStatus": "Scheduled"
      }
    }
  • If you restart the instance before the time specified by the notBefore field, the O&M event is avoided and ECS sends you a notification which indicates that the status of the O&M event changes to Avoided (Avoided). Sample notification:

    {
      "id": "2256A988-0B26-4E2B-820A-8A********E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "CRITICAL",
      "name": "Instance:SystemMaintenance.Reboot:Scheduled",
      "userId": "169070********30",
      "eventTime": "20190410T160101.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
        "eventId": "e-bp11trdr********qum2",
        "publishTime": "2019-04-09T04:18:26Z",
        "notBefore": "2019-04-12T01:01:01Z",
        "instanceId": "i-bp1ecr********5go2go",
        "eventType": "SystemMaintenance.Reboot",
        "eventStatus": "Avoided",
        "executeStartTime": "2019-04-10T08:01:01Z",  
        "executeFinishTime": "2019-04-10T08:01:01Z"  
      }
    }

The following table describes the fields that are contained in the content parameter.

Field

Description

Example

eventId

The ID of the O&M event.

e-t4navn7********6x5no

publishTime

The time when the O&M event is published.

2019-04-09T04:18:26Z

notBefore

The scheduled start time of the O&M event. The notBefore field is available only for maintenance events.

2019-04-12T01:01:01Z

instanceId

The ID of the affected instance.

i-bp1ecr********5go2go

eventType

The type of the O&M event. For information about the valid values of this field, see Overview.

SystemMaintenance.Reboot

eventStatus

The status of the O&M event. For information about the valid values of this field, see Overview.

Avoided

executeStartTime

The start time of the O&M task that is related to the event. The time is in UTC.

2019-04-10T08:01:01Z

executeFinishTime

The end time of the O&M task that is related to the event. The time is in UTC.

Note

The executeStartTime and executeFinishTime fields are available only for O&M events that are in the Executing (Executing), Executed (Executed), Canceled (Canceled), or Avoided (Avoided) state.

2019-04-10T08:01:01Z

Lifecycle status change events

When the status of your instance changes, ECS sends you an event notification. For information about instance status changes, see Instance lifecycle.

The following sample code provides an example of an event notification sent when the status of an instance changes to Running (Running):

{
  "id": "2256A988-0B26-4E2B-820A-8A********E5",
  "product": "ECS",
  "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
  "level": "INFO",
  "name": "Instance:StateChange",
  "userId": "169070********30",
  "eventTime": "20190409T121826.922+0800",
  "regionId": "cn-hangzhou",
  "content": {
    "resourceId": "i-bp1ecr********5go2go",  
    "resourceType": "ALIYUN::ECS::Instance", 
    "state": "Running"                       
  }
}

The following table describes the fields that are contained in the content parameter.

Field

Description

Example

resourceId

The ID of the instance.

i-bp1ecr********5go2go

resourceType

The type of the resource. Valid value: ALIYUN::ECS::Instance.

ALIYUN::ECS::Instance

state

The status of the instance. Valid values:

  • Created: The instance is created. A notification which indicates that an instance is in the Created lifecycle state is sent only once after the instance is created.

  • Starting: The instance is being started.

  • Running: The instance is running.

  • Stopping: The instance is being stopped or restarted.

  • Stopped: The instance is stopped.

  • Deleted: The instance is released.

Running

Preemptible instance release events

Preemptible instances may be released due to fluctuations in market price or insufficient resources. ECS sends an event notification 5 minutes before a preemptible instance is released to notify you of the interruption of the instance. For more information, see Overview.

The following sample code provides an example of an event notification in the JSON format:

{
  "id": "2256A988-0B26-4E2B-820A-8A********E5",
  "product": "ECS",
  "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
  "level": "INFO",
  "name": "Instance:PreemptibleInstanceInterruption",
  "userId": "169070********30",
  "eventTime": "20190409T121826.922+0800",
  "regionId": "cn-hangzhou",
  "content": {
    "instanceId": "i-bp1ecr********5go2go",  
    "action": "delete"                       
  }
}

The following table describes the fields that are contained in the content parameter.

Field

Description

Example

instanceId

The ID of the preemptible instance.

i-bp1ecr********5go2go

action

The action that is performed on the preemptible instance. Valid value: delete.

delete

Hot migration events for instances on dedicated hosts

You can call the ModifyInstanceDeployment operation to perform hot migration to migrate an instance between dedicated hosts. Hot migration is an asynchronous operation, and the status of the instance does not change during the migration process. You can configure notifications for the Instance:LiveMigrationAcrossDDH event to receive updates about the migration task progress.

The following snippets of sample code provide examples of event notifications in the JSON format:

  • Sample notification for the event that the hot migration task starts:

    {
      "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "INFO",
      "instanceName": "instance-event-subscription",
      "name": "Instance:LiveMigrationAcrossDDH",
      "userId": "169070********30",
      "eventTime": "20180608T092537.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
          "instanceId" : "i-bp1ecr********5go2go",
          "sourceDedicatedHostId" : "dh-2ze3lm********t8nr82",
          "destinationDedicatedHostId" : "dh-2ze3lm********t8nr83",
          "startTime" : "2018-06-08T01:25:37Z",
          "status" : "started"
      }
    }
  • Sample notification for the event that the hot migration task is completed:

    {
      "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "INFO",
      "instanceName": "instance-event-subscription",
      "name": "Instance:LiveMigrationAcrossDDH",
      "userId": "169070********30",
      "eventTime": "20180608T092545.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
          "instanceId" : "i-bp1ecr********5go2go",
          "sourceDedicatedHostId" : "dh-2ze3lm********t8nr82",
          "destinationDedicatedHostId" : "dh-2ze3lm********t8nr83",
          "startTime" : "2018-06-08T01:25:37Z",
          "endTime" : "2018-06-08T01:25:45Z",
          "status" : "accomplished"
      }
    }
  • Sample notification for the event that the hot migration task failed:

    {
      "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
      "product": "ECS",
      "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
      "level": "INFO",
      "instanceName": "instance-event-subscription",
      "name": "Instance:LiveMigrationAcrossDDH",
      "userId": "169070********30",
      "eventTime": "20180608T092545.922+0800",
      "regionId": "cn-hangzhou",
      "content": {
          "instanceId" : "i-bp1ecr********5go2go",
          "sourceDedicatedHostId" : "dh-2ze3lm********t8nr82",
          "destinationDedicatedHostId" : "dh-2ze3lm********t8nr83",
          "startTime" : "2018-06-08T01:25:37Z",
          "endTime" : "2018-06-08T01:25:45Z",
          "status" : "failed"
      }
    }

The following table describes the fields that are contained in the content parameter.

Field

Description

Example

instanceId

The ID of the instance.

i-bp1ecr********5go2go

sourceDedicatedHostId

The ID of the source dedicated host.

dh-2ze3lm********t8nr82

destinationDedicatedHostId

The ID of the destination dedicated host.

dh-2ze3lm********t8nr83

startTime

The start time of the hot migration task. The time is in UTC.

2018-06-08T01:25:37Z

endTime

The end time of the hot migration task. The time is in UTC.

2018-06-08T01:25:45Z

status

The status of the hot migration task. Valid values:

  • started: The migration task starts.

  • failed: The migration task failed.

  • accomplished: The migration task is completed.

accomplished

Performance mode change events for burstable instances

If the performance mode of a burstable instance changes, ECS sends a notification for the Instance:PerformanceModeChange event.

The following sample code provides an example of an event notification in the JSON format:

{
    "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
    "product": "ECS",
    "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
    "level": "INFO",
    "name": "Instance:PerformanceModeChange",
    "userId": "169070********30",
    "eventTime": "20190409T121826.922+0800",
    "regionId": "cn-hangzhou",
    "content": {
        "instanceId" : "i-bp1ecr********5go2go",
        "creditSpecification" : "Unlimited",
        "operator" : "System"
    }
}

The following table describes the fields that are contained in the content parameter.

Field

Description

Example

instanceId

The ID of the burstable instance.

i-bp1ecr********5go2go

creditSpecification

The new performance mode of the burstable instance. Valid values:

  • Standard: standard mode

  • Unlimited: unlimited mode

Standard

operator

The operator that triggers the event. Valid values:

  • User: The performance mode of the instance is manually changed by using the ECS console or by calling an API operation.

  • System: The performance mode of the instance is automatically changed. The performance mode of your burstable instance may be automatically changed in the following scenarios: CPU credits are exhausted, the economical mode is triggered, or overdue payments exist in your account. For more information, see Switch the performance mode of a burstable instance.

User

Limited performance events for burstable instances

When the CPU credits of a burstable instance are exhausted, the instance is limited to its baseline performance and runs in standard mode. If the preceding scenario occurs, an event named Instance:BurstablePerformanceRestricted is generated.

Note

Each Instance:BurstablePerformanceRestricted event lasts 1 hour. The start time and end time of the event are 1 hour apart. The event indicates that the instance is limited to its baseline performance for part of the event window, but does not necessarily indicate that the instance is limited to its baseline performance throughout the entire event window. If the instance remains limited to its baseline performance for an extended period of time, an Instance:BurstablePerformanceRestricted event is generated every hour.

The following sample code provides an example of an event notification in the JSON format:

{
    "id": "2256A988-0B26-4E2B-820A-8A0580D0B8E5",
    "product": "ECS",
    "resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
    "level": "INFO",
    "name": "Instance:BurstablePerformanceRestricted",
    "userId": "169070********30",
    "eventTime": "20190409T121826.922+0800",
    "regionId": "cn-hangzhou",
    "content": {
        "instanceId" : "i-bp1ecr********5go2go",
        "intervalStart" : "2019-11-11T11:00Z",
        "intervalEnd" : "2019-11-11T12:00Z"
    }
}

The following table describes the fields that are contained in the content parameter.

Field

Description

Example

instanceId

The ID of the instance.

i-bp1ecr********5go2go

intervalStart

The start time of the event window. The time is in UTC.

2019-11-11T11:00Z

intervalEnd

The end time of the event window. The time is in UTC.

2019-11-11T12:00Z

Appendix: Notifications for instance-related O&M events

Impact

Event type and code

Event notification name and code

The instance is restarted.

Instance restart due to system maintenance (SystemMaintenance.Reboot)

  • Instance restart scheduled (system maintenance): Instance:SystemMaintenance.Reboot:Scheduled

  • Scheduled instance restart being executed (system maintenance): Instance:SystemMaintenance.Reboot:Executing

  • Scheduled instance restart completed (system maintenance): Instance:SystemMaintenance.Reboot:Executed

  • Scheduled instance restart avoided (system maintenance): Instance:SystemMaintenance.Reboot:Avoided

  • Scheduled instance restart canceled (system maintenance): Instance:SystemMaintenance.Reboot:Canceled

  • Scheduled instance restart failed (system maintenance): Instance:SystemMaintenance.Reboot:Failed

The instance is unexpectedly restarted.

Instance restart due to system errors (SystemFailure.Reboot)

  • Instance restart being executed (system error): Instance:SystemFailure.Reboot:Executing

  • Instance restart completed (system error): Instance:SystemFailure.Reboot:Executed

The instance is unexpectedly restarted.

Instance restart due to instance errors: InstanceFailure.Reboot

  • Instance restart being executed (instance error): Instance:InstanceFailure.Reboot:Executing

  • Instance restart completed (instance error): Instance:InstanceFailure.Reboot:Executed

The instance is redeployed.

Instance redeployment due to system maintenance (SystemMaintenance.Redeploy)

  • Instance redeployment scheduled (system maintenance): Instance:SystemMaintenance.Redeploy:Scheduled

  • Scheduled instance redeployment being executed (system maintenance): Instance:SystemMaintenance.Redeploy:Executing

  • Scheduled instance redeployment completed (system maintenance): Instance:SystemMaintenance.Redeploy:Executed

  • Scheduled instance redeployment avoided (system maintenance): Instance:SystemMaintenance.Redeploy:Avoided

  • Scheduled instance redeployment canceled (system maintenance): Instance:SystemMaintenance.Redeploy:Canceled

The instance is redeployed.

Instance redeployment due to system errors (SystemFailure.Redeploy)

  • Instance redeployment scheduled (system error): Instance:SystemFailure.Redeploy:Scheduled

  • Instance redeployment being executed (system error): Instance:SystemFailure.Redeploy:Executing

  • Instance redeployment completed (system error): Instance:SystemFailure.Redeploy:Executed

  • Instance redeployment avoided (system error): Instance:SystemFailure.Redeploy:Avoided

  • Instance redeployment canceled (system error): Instance:SystemFailure.Redeploy:Canceled

The instance is restarted and the damaged local disk is isolated.

Instance restart and local disk replacement due to system maintenance (SystemMaintenance.RebootAndIsolateErrorDisk)

  • Inquiring about instance restart and local disk isolation (system maintenance): Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Inquiring

  • Instance restart and damaged disk isolation being executed (system maintenance): Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Executing

  • Instance restart and damaged disk isolation completed (system maintenance): Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Executed

  • Instance restart and damaged disk isolation avoided (system maintenance): Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Avoided

  • Instance restart and damaged disk isolation canceled (system maintenance): Instance:SystemMaintenance.RebootAndIsolateErrorDisk:Canceled

The instance is restarted and the damaged local disk is restored.

Instance restart and local disk re-initialization due to system maintenance (SystemMaintenance.RebootAndReInitErrorDisk)

  • Inquiring about instance restart and damaged disk re-initialization (system maintenance): Instance:SystemMaintenance.RebootAndReInitErrorDisk:Inquiring

  • Instance restart and damaged disk re-initialization being executed (system maintenance): Instance:SystemMaintenance.RebootAndReInitErrorDisk:Executing

  • Instance restart and damaged disk re-initialization completed (system maintenance): Instance:SystemMaintenance.RebootAndReInitErrorDisk:Executed

  • Instance restart and damaged disk re-initialization avoided (system maintenance): Instance:SystemMaintenance.RebootAndReInitErrorDisk:Avoided

  • Instance restart and damaged disk re-initialization canceled (system maintenance): Instance:SystemMaintenance.RebootAndReInitErrorDisk:Canceled

The instance is released.

Automatic instance release due to instance creation failures (SystemFailure.Delete)

  • Automatic instance release being executed (instance creation failure): Instance:SystemFailure.Delete:Executing

  • Automatic instance release completed (instance creation failure): Instance:SystemFailure.Delete:Executed

  • Automatic instance release avoided (instance creation failure): Instance:SystemFailure.Delete:Avoided