Event messages
This section contains information about messages published by Amazon IoT when things or jobs are
updated or changed. For information about the Amazon IoT Events service that allows you to create
detectors to monitor your devices for failures or changes in operation, and to trigger
actions when they occur, see Amazon IoT Events
How event messages are generated
Amazon IoT publishes event messages when certain events occur. For example, events are generated by the registry when things are added, updated, or deleted. Each event causes a single event message to be sent. Event messages are published over MQTT with a JSON payload. The content of the payload depends on the type of event.
Note
Event messages are guaranteed to be published once. It is possible for them to be published more than once. The ordering of event messages is not guaranteed.
Policy for receiving event messages
To receive event messages, your device must use an appropriate policy that allows it to connect to the Amazon IoT device gateway and subscribe to MQTT event topics. You must also subscribe to the appropriate topic filters.
The following is an example of the policy required for receiving lifecycle events:
{ "Version":"2012-10-17", "Statement":[{ "Effect":"Allow", "Action":[ "iot:Subscribe", "iot:Receive" ], "Resource":[ "arn:aws:iot:
region
:account
:/$aws/events/*" ] }] }
Enable events for Amazon IoT
Before subscribers to the reserved topics can receive messages, you must enable event messages from the Amazon Web Services Management Console or by using the API or CLI. For information about the event messages that the different options manage, see the Table of Amazon IoT event configuration settings.
-
To enable event messages, go to the Settings
tab of the Amazon IoT console and then, in the Event-based messages section, choose Manage events. You can specify the events that you want to manage. -
To control which event types are published by using the API or CLI, call the UpdateEventConfigurations API or use the update-event-configurations CLI command. For example:
aws iot update-event-configurations --event-configurations "{\"THING\":{\"Enabled\": true}}"
Note
All quotation marks (") are escaped with a backslash (\).
You can get the current event configuration by calling the DescribeEventConfigurations API or by using the describe-event-configurations CLI command. For example:.
aws iot describe-event-configurations
Table of Amazon IoT event configuration settings
Event category (Amazon IoT Console: Settings: Event-based messages) |
(Amazon CLI/API) |
Event message topic |
---|---|---|
(Can only be configured by using the Amazon CLI/API) |
|
|
(Can only be configured by using the Amazon CLI/API) |
|
|
(Can only be configured by using the Amazon CLI/API) |
|
|
(Can only be configured by using the Amazon CLI/API) |
|
|
(Can only be configured by using the Amazon CLI/API) |
|
|
Job completed, canceled |
|
|
Job completed, canceled |
|
|
Job completed, canceled |
|
|
Job completed, canceled |
|
|
Job completed, canceled |
|
|
Job execution: success, failed, rejected, canceled, removed |
|
|
Job execution: success, failed, rejected, canceled, removed |
|
|
Job execution: success, failed, rejected, canceled, removed |
|
|
Job execution: success, failed, rejected, canceled, removed |
|
|
Job execution: success, failed, rejected, canceled, removed |
|
|
Job execution: success, failed, rejected, canceled, removed |
|
|
Job execution: success, failed, rejected, canceled, removed |
|
|
Thing: created, updated, deleted |
|
|
Thing: created, updated, deleted |
|
|
Thing: created, updated, deleted |
|
|
Thing group: added, removed |
|
|
Thing group: added, removed |
|
|
Thing group: added, removed |
|
|
Thing group hierarchy: added, removed |
|
|
Thing group hierarchy: added, removed |
|
|
Thing group membership: added, removed |
|
|
Thing group membership: added, removed |
|
|
Thing type: created, updated, deleted |
|
|
Thing type: created, updated, deleted |
|
|
Thing type: created, updated, deleted |
|
|
Thing type association: added, removed |
|
|