Engravion
Software & IoT Solutions
🚀 Engravion 3.0 is live — faster, smarter, more powerful. Read the release notes →
Tutorials

ESP32 to AWS IoT Core: Production-Ready Architecture

A step-by-step guide to building a production-grade IoT pipeline from ESP32 firmware through AWS IoT Core to a time-series database — including the security details most tutorials skip.

Super Admin May 4, 2026 2 min read 4,352 views

Most ESP32 + AWS IoT tutorials show you how to publish a temperature reading. This guide shows you how to build something you can actually put into production — with mutual TLS, certificate rotation, dead-letter queues, and proper observability.

The Architecture

Our target architecture: ESP32 devices communicate with AWS IoT Core over MQTT with mutual TLS. IoT Core routes messages through IoT Rules to a Kinesis Data Stream, which feeds a Lambda function that writes to TimescaleDB (PostgreSQL with time-series extensions). A Grafana dashboard sits on top for visualisation.

Device Identity and Certificates

Every device gets a unique X.509 certificate provisioned via AWS IoT Fleet Provisioning. Certificates have a 1-year lifetime and are automatically rotated 30 days before expiry using a Just-In-Time Registration (JITR) flow.

The Firmware Side

We use ESP-IDF (not Arduino) for production firmware. The key libraries are esp-mqtt for the MQTT client and esp-tls for the TLS stack. We store the device certificate and private key in NVS with encryption enabled via the esp-idf NVS encryption feature.

Handling Connectivity Loss

Production devices will lose connectivity. Our firmware implements a local circular buffer that stores up to 72 hours of sensor readings in flash. On reconnection, a backfill task publishes queued messages in batches, respecting MQTT QoS 1 for at-least-once delivery.

Share this article: X LinkedIn Facebook

0 Comments

Leave a Comment

Comments are moderated and appear once approved.

Super Admin

Author

মেসেজ করুন