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:
| 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:
| 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 |
operator | The operator that triggers the event. Valid values:
| 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.
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) |
|
The instance is unexpectedly restarted. | Instance restart due to system errors (SystemFailure.Reboot) |
|
The instance is unexpectedly restarted. | Instance restart due to instance errors: InstanceFailure.Reboot |
|
The instance is redeployed. | Instance redeployment due to system maintenance (SystemMaintenance.Redeploy) |
|
The instance is redeployed. | Instance redeployment due to system errors (SystemFailure.Redeploy) |
|
The instance is restarted and the damaged local disk is isolated. | Instance restart and local disk replacement due to system maintenance (SystemMaintenance.RebootAndIsolateErrorDisk) |
|
The instance is restarted and the damaged local disk is restored. | Instance restart and local disk re-initialization due to system maintenance (SystemMaintenance.RebootAndReInitErrorDisk) |
|
The instance is released. | Automatic instance release due to instance creation failures (SystemFailure.Delete) |
|