Posted On: Aug 24, 2021

Retained messages is a standard MQTT feature that provides an easy way for you to store the latest important message on a topic for future subscribers. With Amazon IoT Core, you can now use retained messages to easily push configuration information or important updates to devices without knowing exactly when they will come online.

When you publish a message with the retained flag set, all current subscribers to that topic will receive the message as normal, but Amazon IoT Core will also store the message and automatically deliver it to any future subscribers. As a result, you do not have to worry about tracking when devices come online in order to make sure they receive the message, or alternatively having them wait for the next publish message.

You can use the Amazon IoT Device SDKs or your own MQTT 3.1.1 compliant client to publish a retained message. Alternatively, you can use HTTP APIs via the Amazon CLI to publish, get, and retrieve the retained messages. In addition, you can view and manage retained messages in your account from the Retained messages page in the Amazon IoT Core console. This page provides a paginated list of MQTT topics that have a retained message, and enables you to retrieve, update, or delete the retained message for a specific MQTT topic.

The retained messages feature is supported in the Amazon Web Services China (Beijing) Region, operated by Sinnet, and the Amazon Web Services China (Ningxia) Region, operated by NWCD. Visit the MQTT retained messages documentation to learn more. For information about Amazon IoT Core, visit the product page.