Skip to content

Teardown and Cleanup

  1. Cleanup API and hosting surfaces first ( AMPLIFY
    AWS Amplify — hosts the walkthrough dashboard frontend and connects it to the query API URL.
    and API Gateway
    Amazon API Gateway — exposes HTTP routes for latest telemetry and recent events. The browser reads data through API Gateway, not DynamoDB directly.
    workflow)
  2. Destroy TERRAFORM
    HashiCorp Terraform — provisions shared infrastructure (IoT rules fan-out, Lambda, DynamoDB, API Gateway, Amplify).
    -managed infrastructure
  3. Deprovision device credentials and IoT Core
    AWS IoT Core — managed MQTT broker with X.509 device authentication for ESP32 telemetry and events.
    registration
Terminal window
terraform -chdir=terraform destroy

Full teardown (device + CloudFormation stack):

Terminal window
FORCE=1 REMOVE_LOCAL=1 AWS_REGION=ap-southeast-2 THING_NAME=esp32-c ./aws/deprovision.sh

Partial cleanup:

Terminal window
# Device only — keep Phase 1 CloudFormation stack
FORCE=1 DEVICE_ONLY=1 AWS_REGION=ap-southeast-2 THING_NAME=esp32-c ./aws/deprovision.sh
# Shared infra only — delete stack esp32-demo-phase1; keep Thing/certs
FORCE=1 INFRA_ONLY=1 AWS_REGION=ap-southeast-2 ./aws/deprovision.sh

FORCE=1 is required — the script deletes AWS resources.