Skip to content

Prerequisites, apply, ingest, and teardown

  • Clone terraform-aws-s3-annotations-demo — all terraform, aws, and curl commands in this walkthrough run from that repository
  • AWS account (S3, Lambda, API Gateway, Amplify, IAM; optional DynamoDB)
  • Terraform ≥ 1.6, Node.js + npm, Python 3.14, AWS CLI ≥ 2.35.6, boto3 ≥ 1.43.32, pip3, zip
Terminal window
cd terraform
terraform init
terraform apply

Terraform builds and deploys the React app by default (deploy_amplify_on_apply = true).

After apply, Terraform automatically builds and deploys the React app to Amplify. Open the URL from output amplify_app_url, click Apply Filters, and load images.

Useful when CI lacks Node.js:

Terminal window
terraform apply -var='deploy_amplify_on_apply=false'
./scripts/deploy-amplify.sh # run manually later with env vars set

Schedule a single ingest run at a future UTC time:

Terminal window
terraform apply \
-var='enable_scheduler=true' \
-var='schedule_time=2026-06-19T08:00:00'

Or copy terraform/terraform.tfvars.example to terraform.tfvars, uncomment enable_scheduler and schedule_time, then run terraform apply.

Note: schedule_time must be a future UTC datetime: YYYY-MM-DDTHH:mm:ss. The scheduler fires once and auto-deletes.

  • Scheduler is off by default (enable_scheduler = false) so terraform apply and terraform destroy never ask for schedule_time.
  • When enabled, EventBridge fires once at schedule_time and auto-deletes (action_after_completion = DELETE).
  • To schedule another run after the first fires: set a new schedule_time and terraform apply again.
MethodWhen to use
Manual invokeRun ingest immediately (demo/testing)
SchedulerFire ingest once at a chosen UTC time
Terminal window
aws lambda invoke \
--function-name volcano-ingest \
--payload '{}' \
--cli-binary-format raw-in-base64-out \
/tmp/ingest-result.json

Response body includes images_copied, images_annotated, annotation_failures, date.

VariableDefaultNotes
aws_regionap-southeast-2AWS region for all resources
enable_dynamodbfalseOptional annotation mirror
enable_schedulerfalseOne-time ingest schedule
deploy_amplify_on_applytrueBuild gallery after apply
schedule_time2099-01-01T00:00:00Ignored if scheduler off
private_bucket_namevolcano-annotations-demo-private
amplify_app_namevolcano-annotations-demo
SymptomLikely causeWhat to do
Gallery 503 on Apply FiltersFiltered API scan timed out (30s API Gateway limit)Reduce bucket size (INGEST_LOOKBACK_DAYS), enable DynamoDB mirror, or see API performance
Gallery 503 on first load (no filters)Old API handler or very large bucketterraform apply to pick up page-first fetching; consider teardown + re-apply
Terminal window
cd terraform
terraform destroy -auto-approve

force_destroy = true on the private bucket empties objects (and their annotations) automatically.

Resources removed by terraform destroy:

  • Private S3 bucket (including all objects)
  • Amplify Hosting application
  • Ingest Lambda and API Lambda
  • API Gateway HTTP API
  • EventBridge Scheduler (if it hasn’t auto-deleted yet)
  • IAM roles and policies
  • DynamoDB table (when enabled)

Confirm all resources are gone:

Terminal window
terraform state list # should be empty after destroy