This topic provides an overview of Elastic Compute Service (ECS) event notifications. Event notifications provide information about resource changes. Notifications can be sent for the following events: system events, including O&M events and exceptions, instance status changes, events in which data disks are attached or detached, and events in which snapshots are created. Event notifications allow you to configure message processing middleware for events to implement event-driven automated O&M in place of SDK polling.
Event notification name
After you configure notifications for events, you are notified when the events occur. The name field of a notification indicates the code name of the event. This field is in the <resource type>:<event>:<status> format.
<resource type>: the type of the ECS resource. Example values: Instance and Disk. Instance indicates ECS instances and Disk indicates Block Storage devices.
<event>: the name of the event. Example values: SystemMaintenance.Reboot, StateChange, PreemptibleInstanceInterruption, DiskOperationCompleted, and CreateSnapshotCompleted.
<status>: the status of the event. For information about the valid values of this field, see Overview.
NoteThe <status> field is available only for system events that are related to instances and Block Storage devices.
Event notification format
After you configure event notifications, ECS notifies you based on the method that you specify. The following sample code provides an example of a non-customized event notification in the JSON format. This notification is sent for events in which the state of an ECS instance changes.
If the notification method that you specify supports format conversion, the notification that you receive may be converted to other formats.
{
"eventTime": "20181226T220114.058+0800",
"id": "9435EAD6-3CF6-4494-8F7A-3A********77",
"level": "INFO",
"name": "Instance:StateChange",
"product": "ECS",
"regionId": "cn-hangzhou",
"resourceId": "acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go",
"userId": "169070********30",
"ver": "1.0",
"content": {
"resourceId": "i-bp1ecr********5go2go",
"resourceType": "ALIYUN::ECS::Instance",
"state": "Stopping"
}
}
The following table describes fixed top-level fields in a notification.
Field | Description | Example |
id | The ID of the event. | 9435EAD6-3CF6-4494-8F7A-3A********77 |
eventTime | The time when the event occurred. The time is displayed in UTC+8. | 20181226T220114.058+0800 |
level | The level of the event. Valid values:
| INFO |
name | The name of the event. For more information, see the Event notification name section. | Instance:StateChange |
product | The name of the service. Set the value to ECS. | ECS |
regionId | The ID of the region where the event occurred. For information about the valid values of this field, see Regions and zones. | cn-hangzhou |
resourceId | The Alibaba Cloud Resource Name (ARN) of the resource. | acs:ecs:cn-hangzhou:169070********30:instance/i-bp1ecr********5go2go |
userId | The ID of the Alibaba Cloud account. | 169070********30 |
content | The event details. This field can contain one or more subfields. For more information about the subfields, see the following topics: | None |