Skip to content

Teardown

Progress checklist

demo.sh down tears the lab down in order:

  1. Auth check + backup .lab-state.json.lab-state.json.bak
  2. EventBridge / rebuild Lambda / ECR
  3. UI bucket
  4. Consumers (both OS probes) and lab VPCs in each Region
  5. GPG signing secret (force-delete)
  6. Package buckets (empty all versions) and shared IAM roles
  7. Verify key resources are gone, then clear state + .bak

Confirmation required (y). Idempotent re-runs treat already-gone resources as success; incomplete teardown keeps state so you can fix and re-run.

Teardown order for demo.sh down Lambda/UI first; per Region terminate probes, delete VPCEs and VPC; then GPG secret, package buckets, and IAM roles. down: consumers, GPG secret, then buckets 1 Probe EC2 terminate 2 VPCEs SSM + S3 GW 3 Lab VPC Syd then Akl 4 Buckets empty + delete 5 CRR role + .lab-state.json Per consumer Region: always pass --region (AWS_REGION must not stick) Wait for instance terminated and VPCEs fully deleted before subnet/VPC delete Confirm with y when prompted
  1. Destroy (type y when prompted):

    Terminal window
    export AWS_PROFILE=sandbox
    ./scripts/demo.sh down

    Abbreviated finish:

    Destroy lab resources described in …/.lab-state.json? [y/N] y
    state backup: …/.lab-state.json.bak
    … delete-rule / delete-function / delete-repository …
    emptying ps3p-ui-**ACCOUNT**-syd (ap-southeast-2)
    tearing down consumer syd in ap-southeast-2
    tearing down consumer akl in ap-southeast-6
    … delete-secret … ps3p-gpg-<suffix> … --force-delete-without-recovery
    emptying ps3p-pkgs-**ACCOUNT**-syd (ap-southeast-2)
    emptying ps3p-pkgs-**ACCOUNT**-akl (ap-southeast-6)
    down complete
Terminal window
test ! -f .lab-state.json && test ! -f .lab-state.json.bak && echo "state cleared"
state cleared
Terminal window
aws s3api head-bucket --bucket ps3p-pkgs-**ACCOUNT**-syd --region ap-southeast-2
aws s3api head-bucket --bucket ps3p-ui-**ACCOUNT**-syd --region ap-southeast-2
An error occurred (404) when calling the HeadBucket operation: Not Found
Terminal window
aws lambda get-function --function-name ps3p-rebuild-<suffix> --region ap-southeast-2
aws secretsmanager describe-secret --secret-id ps3p-gpg-<suffix> --region ap-southeast-2
An error occurred (ResourceNotFoundException) when calling the GetFunction operation: Function not found: …
An error occurred (ResourceNotFoundException) when calling the DescribeSecret operation: Secrets Manager can't find the specified secret.