Skip to content

Terraform Provisioning

For Terraform module layout and Lambda paths, see Stack Source Layout and Ingest Pipeline.

From 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.
root:

Terminal window
cp terraform/terraform.tfvars.example terraform/terraform.tfvars
terraform -chdir=terraform init
terraform -chdir=terraform plan
terraform -chdir=terraform apply

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

  • IoT rules
    AWS IoT Rules — route incoming MQTT messages to Lambda and CloudWatch Logs for ingest and verification.
    fan-out
  • LAMBDA
    AWS Lambda — processes IoT rule payloads and serves query API logic behind API Gateway.
    processing
  • DYNAMODB
    Amazon DynamoDB — persists telemetry and event records after Lambda ingest in Phase 2.
    persistence
  • Query LAMBDA
    AWS Lambda — processes IoT rule payloads and serves query API logic behind API Gateway.
  • API Gateway
    Amazon API Gateway — exposes HTTP routes for latest telemetry and recent events. The browser reads data through API Gateway, not DynamoDB directly.
    routes
  • AMPLIFY
    AWS Amplify — hosts the walkthrough dashboard frontend and connects it to the query API URL.
    resources
Terminal window
terraform -chdir=terraform output
terraform -chdir=terraform output -json > terraform/outputs.dev.json

Required outputs:

  • query_api_invoke_url
  • telemetry_table_name
  • events_table_name
  • amplify_app_url
Terminal window
TELEMETRY_TABLE="$(terraform -chdir=terraform output -raw telemetry_table_name)"
EVENTS_TABLE="$(terraform -chdir=terraform output -raw events_table_name)"
aws dynamodb scan --table-name "$TELEMETRY_TABLE" --max-items 5
aws dynamodb scan --table-name "$EVENTS_TABLE" --max-items 5

Each scan should return at least one item after device publishes have flowed through the ingest path.

Continue with Query API Validation for Phase 3.