Stack Source Layout
The Terraform stack
Terraform modules in `terraform/` of the demo repo — provisions the full serverless ingest and query stack. lives in the demo repository
esp32-aws-iot-demo — source repository for firmware, provisioning scripts, Terraform, and dashboard code. Commands run from its root unless stated otherwise. under terraform/. Browse on GitHub: esp32-aws-iot-demo/terraform.
For apply commands and outputs, see Terraform Provisioning. For ingest behavior, see Ingest Pipeline.
Directory tree
Section titled “Directory tree”terraform/├── main.tf # module composition entry point├── variables.tf├── outputs.tf├── providers.tf├── backend.tf├── versions.tf├── terraform.tfvars.example└── modules/ ├── dynamodb/ ├── lambda_processor/ ├── iot_rule_fanout/ ├── lambda_query_api/ ├── api_gateway/ └── amplify_hosting/Module composition (main.tf)
Section titled “Module composition (main.tf)”terraform/main.tf wires modules in dependency order:
- CloudWatch log groups (
/aws/iot/esp32-demo/*) dynamodb— telemetry and events tableslambda_processor— ingest handleriot_rule_fanout— rules fan-out to CloudWatch + processor Lambdalambda_query_api— read-only query handlerapi_gateway— HTTP routes to query Lambdaamplify_hosting— dashboard app + optional deploy on apply
Module reference
Section titled “Module reference”| Module | Purpose | Key outputs |
|---|---|---|
modules/dynamodb | Dual tables with GSI |
|
modules/lambda_processor | Ingest LAMBDA Amazon DynamoDB — persists telemetry and event records after Lambda ingest in Phase 2. | function_arn |
modules/iot_rule_fanout | IoT rules |
|
modules/lambda_query_api | Query LAMBDA | function_arn |
modules/api_gateway | HTTP API routes + CORS for the dashboard browser | invoke_url |
modules/amplify_hosting | AMPLIFY | amplify_app_url |
Lambda source locations
Section titled “Lambda source locations”| Lambda | Handler source |
|---|---|
| Processor (ingest) | terraform/modules/lambda_processor/src/handler.py |
| Query API | terraform/modules/lambda_query_api/src/handler.py |
Each module packages src/ into a zip at apply time. Unit tests live under src/tests/ in each module.