IoT System with AWS

AWS IoT Core architecture for ESP32 + FreeRTOS fleets — code-signed OTA, fleet provisioning, Device Shadow, and targeted IoT Jobs rollouts.

IoT Platform AWS IoT Core FreeRTOS

Published on March 6, 2025

OTA firmware update flow on AWS IoT Core with ESP32 and FreeRTOS
IoT Platform

IoT System with AWS

Introduction

Taking a connected device from a working prototype to a production fleet on AWS comes down to four building blocks: secure firmware updates, fleet provisioning, device‑state synchronization, and targeted job orchestration. The diagrams below capture the patterns we use on AWS IoT Core to ship ESP32‑class devices safely and operate them at scale.

1. OTA Firmware Updates (ESP32 + Amazon FreeRTOS)

The device runs Amazon FreeRTOS with an OTA agent. New firmware images are signed with an AWS Certificate Manager code‑signing certificate and stored in S3; AWS IoT Core creates an OTA job that the device picks up over MQTT. The agent verifies the signature with the device's private key before swapping from version 092 to 093 — so a tampered or interrupted image can never become active firmware.

2. Fleet Provisioning

Devices ship with a bootstrap certificate and request their production identity at first boot. The device presents its bootstrap cert plus a CSR; a custom Lambda validates ownership, IoT Core enacts the birth policy, signs the CSR, and returns the official certificate. A provisioning template then runs automatically — creating the Thing, attaching it to the right groups, and applying the production policy. Each unit ends up with a unique, revocable identity without any manual setup at the factory.

3. Device Shadow

Each Thing has a JSON shadow that holds desired and reported state. The device publishes its current state to deviceId/shadow/update; the cloud writes the desired state to the same topic, and the broker fans out a /update/delta message to the device so it knows what changed. The device acknowledges via /update/accepted. Apps and dashboards interact with the shadow rather than the device directly, so commands queue cleanly while devices sleep or roam.

4. Targeted Rollouts with IoT Jobs

Production rollouts target subsets of the fleet. We use dynamic groups — queried by shadow attributes such as firmware version or hardware revision — combined with a static "exclude list" group for canaries that should not receive a job. A Lambda function updates target shadow attributes so a rollout can advance ring‑by‑ring, and an IoT job carries the work to every matching device.

Why It Matters

Stitched together, these four patterns take a customer from a single‑device prototype to a fleet‑ready product on AWS — secure firmware updates, hands‑off onboarding, reliable state sync, and staged rollouts — without re‑inventing the cloud stack for every program.