CloudFormation Bootstrap
Phase 1 shared infrastructure is deployed with CloudFormation — not TERRAFORM
HashiCorp Terraform — provisions shared infrastructure (IoT rules fan-out, Lambda, DynamoDB, API Gateway, Amplify). and not per-device. This bootstrap creates the IoT rules
AWS IoT Rules — route incoming MQTT messages to Lambda and CloudWatch Logs for ingest and verification. and CloudWatch
Amazon CloudWatch Logs — stores IoT rule output for Phase 1 verification (`/aws/iot/esp32-demo/telemetry` and `/events`). log groups used in Cloud Verification.
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, with AWS_REGION set (see Prerequisites):
export AWS_REGION=ap-southeast-2./aws/provision-infra.shprovision-infra.sh is also step 1 of ./aws/provision.sh on Device Provisioning.
Stack and template
Section titled “Stack and template”| Item | Value |
|---|---|
| Stack name |
|
| Template | aws/cloudformation/phase1-infra.yaml |
Resources created
Section titled “Resources created”- CloudWatch Logs
Amazon CloudWatch Logs — stores IoT rule output for Phase 1 verification (`/aws/iot/esp32-demo/telemetry` and `/events`). groups: -/aws/iot/esp32-demo/telemetry-/aws/iot/esp32-demo/events-/aws/iot/esp32-demo/errors - IoT rules
AWS IoT Rules — route incoming MQTT messages to Lambda and CloudWatch Logs for ingest and verification. : -esp32_demo_telemetry_ruleesp32_demo_events_rule
- IAM role for rule → CloudWatch delivery (see Policies and IAM)
Verify bootstrap
Section titled “Verify bootstrap”aws cloudformation describe-stacks --stack-name esp32-demo-phase1 --query 'Stacks[0].StackStatus'aws iot get-topic-rule --rule-name esp32_demo_telemetry_rule --query 'rule.ruleDisabled'aws iot get-topic-rule --rule-name esp32_demo_events_rule --query 'rule.ruleDisabled'Expected: stack status CREATE_COMPLETE or UPDATE_COMPLETE; both ruleDisabled queries return false.
Phase 1 vs Phase 2
Section titled “Phase 1 vs Phase 2”This CloudFormation bootstrap is what makes Phase 1 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. CloudWatch verification work. Phase 2 terraform apply (see Terraform Provisioning) provisions the full serverless ingest and query stack.
If bootstrap fails or logs stay empty
Section titled “If bootstrap fails or logs stay empty”- Confirm
aws sts get-caller-identityworks and your principal can create IoT, IAM, CloudFormation, and CloudWatch Logs resources inAWS_REGION. - Re-run
./aws/provision-infra.shif rules or log groups are missing. - For partial infra teardown, see Teardown and Cleanup (
INFRA_ONLY=1).