Skip to content

Project Overview

This walkthrough takes an ESP32-S3
Espressif ESP32 family microcontroller — this walkthrough targets ESP32-S3-N16R8 with PlatformIO firmware.
from local FIRMWARE
PlatformIO-based ESP32 application in `firmware/` — connects to Wi-Fi, syncs time, and publishes MQTT telemetry and events.
setup to a hosted dashboard backed by AWS
Amazon Web Services — the cloud platform used for IoT Core, serverless ingest, storage, API, and hosting in this walkthrough.
data services.

Deliverables across all phases:

  • Device telemetry published over MQTT
    Message Queuing Telemetry Transport — lightweight publish/subscribe protocol used between ESP32 and AWS IoT Core.
    to AWS IoT Core
    AWS IoT Core — managed MQTT broker with X.509 device authentication for ESP32 telemetry and events.
  • Serverless ingest pipeline using IoT Rules
    AWS IoT Rules — route incoming MQTT messages to Lambda and CloudWatch Logs for ingest and verification.
    , LAMBDA
    AWS Lambda — processes IoT rule payloads and serves query API logic behind API Gateway.
    , and DYNAMODB
    Amazon DynamoDB — persists telemetry and event records after Lambda ingest in Phase 2.
  • Query API for latest telemetry and recent button events
  • Hosted dashboard that reads through API Gateway
    Amazon API Gateway — exposes HTTP routes for latest telemetry and recent events. The browser reads data through API Gateway, not DynamoDB directly.
    and LAMBDA
    AWS Lambda — processes IoT rule payloads and serves query API logic behind API Gateway.

Architecture diagram: ESP32-S3 publishes over MQTT to AWS IoT Core, through IoT Rules and Lambda into DynamoDB, then API Gateway and Amplify-hosted dashboard

The browser consumes data through API Gateway
Amazon API Gateway — exposes HTTP routes for latest telemetry and recent events. The browser reads data through API Gateway, not DynamoDB directly.
only. It does not access DYNAMODB
Amazon DynamoDB — persists telemetry and event records after Lambda ingest in Phase 2.
directly.

ESP32 dashboard on Amplify showing live telemetry cards, device and network details, and recent button events

Phase 3 delivers this view — signal, chip temperature, heap, uptime, and events polled from the query API every 15 seconds. Deploy steps are in Dashboard and Hosting.

TermDefinition
Demo Repo
esp32-aws-iot-demo — source repository for firmware, provisioning scripts, Terraform, and dashboard code. Commands run from its root unless stated otherwise.

Source repository

esp32-aws-iot-demo

— all commands run from its root unless stated otherwise

FIRMWARE
PlatformIO-based ESP32 application in `firmware/` — connects to Wi-Fi, syncs time, and publishes MQTT telemetry and events.

PlatformIO ESP32 application in firmware/ that connects to Wi-Fi and publishes MQTT messages

IoT Policy
AWS IoT Core policy — least-privilege MQTT permissions scoped to a device's Thing name and topic namespace.
Least-privilege MQTT permissions for a device certificate
Payload Contract
JSON schema for telemetry (`type=connectivity`) and event (`type=button`, `event=press`) MQTT messages.
JSON schema for telemetry and event MQTT messages
PRETEST
Phase 1 verification flow — Prerequisites through Cloud Verification in the sidebar (includes AWS Provisioning). Proves device-to-cloud connectivity in CloudWatch before full Terraform rollout.

Phase 1 device-to-cloud proof — complete before TERRAFORM
HashiCorp Terraform — provisions shared infrastructure (IoT rules fan-out, Lambda, DynamoDB, API Gateway, Amplify).
rollout. Covers Prerequisites through Cloud Verification in the sidebar (not a separate Pretest section).

Terraform Stack
Terraform modules in `terraform/` of the demo repo — provisions the full serverless ingest and query stack.

TERRAFORM
HashiCorp Terraform — provisions shared infrastructure (IoT rules fan-out, Lambda, DynamoDB, API Gateway, Amplify).
modules in terraform/ provisioning ingest, API, and hosting

THING
AWS IoT Thing — logical device identity (example: `esp32-c`) bound to certificates and MQTT topics.

IoT Core
AWS IoT Core — managed MQTT broker with X.509 device authentication for ESP32 telemetry and events.
device identity (example: esp32-c)

The sidebar follows three phases. Phase 1 is the PRETEST
Phase 1 verification flow — Prerequisites through Cloud Verification in the sidebar (includes AWS Provisioning). Proves device-to-cloud connectivity in CloudWatch before full Terraform rollout.
— prove the device publishes to CloudWatch
Amazon CloudWatch Logs — stores IoT rule output for Phase 1 verification (`/aws/iot/esp32-demo/telemetry` and `/events`).
before provisioning the full stack.

Goal: provision the device, flash firmware, and confirm telemetry and button events in CloudWatch.

Sidebar sections in order:

  1. Introduction — architecture, phases, and key terms
  2. Prerequisites — host tools, AWS access, environment variables
  3. Security — certificate trust model and IoT policy concepts
  4. AWS Provisioning — CloudFormation bootstrap and device provisioning
  5. Firmware — source layout, modules, payload contract, build config
  6. Device Setup — USB permissions, build, flash, serial monitor
  7. Cloud Verification — tail logs and confirm Phase 1 pass criteria

Pass criteria are defined in End-to-End Validation.

Goal: provision shared infrastructure with TERRAFORM
HashiCorp Terraform — provisions shared infrastructure (IoT rules fan-out, Lambda, DynamoDB, API Gateway, Amplify).
and verify records persist to DYNAMODB
Amazon DynamoDB — persists telemetry and event records after Lambda ingest in Phase 2.
.

Sidebar sections:

  1. Infrastructure — stack source layout, ingest pipeline, Terraform apply and DynamoDB validation

Goal: validate query API endpoints and run or deploy the dashboard through AMPLIFY
AWS Amplify — hosts the walkthrough dashboard frontend and connects it to the query API URL.
.

Sidebar sections:

  1. API and Dashboard — query API and dashboard source layouts, endpoint validation, local run and Amplify hosting

Troubleshooting, Future Improvements, and Reference apply across all phases.

See Future Improvements for possible next steps.