AWS IoT
Developer Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Event Messages

Note

This section contains information about messages published by AWS IoT when things or jobs are updated or changed. For information about the AWS 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 AWS IoT Events.

AWS 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.

To receive event messages, your device must use an appropriate policy that allows it to connect to the AWS 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/*" ] }] }

You control which event types are published by calling the UpdateEventConfigurations API or by using 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

The output of the describe-event-configurations command looks like the following:

{ "lastModifiedDate": 1552671347.841, "eventConfigurations": { "THING_TYPE": { "Enabled": false }, "JOB_EXECUTION": { "Enabled": false }, "THING_GROUP_HIERARCHY": { "Enabled": false }, "CERTIFICATE": { "Enabled": false }, "THING_TYPE_ASSOCIATION": { "Enabled": false }, "THING_GROUP_MEMBERSHIP": { "Enabled": false }, "CA_CERTIFICATE": { "Enabled": false }, "THING": { "Enabled": true }, "JOB": { "Enabled": false }, "POLICY": { "Enabled": false }, "THING_GROUP": { "Enabled": false } }, "creationDate": 1552671347.84 }