Teardown
When you are done exploring the demo, destroy the infrastructure to stop all AWS charges. Because every resource is managed by Terraform
HashiCorp Terraform — infrastructure-as-code tool used to provision all AWS resources in this demo. , a single command removes the entire stack — no manual console cleanup required.
Run terraform destroy
Section titled “Run terraform destroy”From the root of the source repo, run:
terraform destroyTerraform displays a plan showing every resource it will remove, then prompts for confirmation:
Plan: 0 to add, 0 to change, 47 to destroy.
Do you really want to destroy all resources? Terraform will destroy all your managed infrastructure, as shown above. There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yesType yes to proceed. The destroy takes approximately 2–3 minutes.
force_destroy behavior
Section titled “force_destroy behavior”Both S3 buckets in this project are configured with force_destroy = true in the Terraform configuration. This means Terraform automatically empties the buckets before deleting them — you do not need to manually remove objects first.
| Bucket type | Contents removed | Terraform resource |
|---|---|---|
| Standard S3 bucket | All ingested article HTML files and metadata | aws_s3_bucket |
| S3 Vectors bucket A specialized S3 bucket type (aws_s3vectors_vector_bucket) that hosts vector indexes for similarity search. | All stored vectors and the vector index | aws_s3vectors_vector_bucket |
What gets removed
Section titled “What gets removed”Terraform destroys resources in reverse dependency order — it removes resources that depend on others first, then works down to foundational resources. You do not need to manage the order yourself.
Complete resource list
Section titled “Complete resource list”| Resource | What is lost |
|---|---|
| S3 bucket | All ingested article documents (HTML content and metadata) |
S3 Vectors | All embedding vectors — similarity search is no longer possible |
Lambda | Compute capacity for ingestion and RAG queries |
| CloudWatch log groups | All Lambda execution logs |
API Gateway | Public API endpoint and route configuration |
Cognito | All user accounts, passwords, and group memberships |
Amplify | Hosted web UI and its HTTPS domain |
EventBridge | Daily ingest cron trigger |
| IAM roles and policies | All least-privilege permissions created for this stack |
Verify resources are gone
Section titled “Verify resources are gone”After the destroy completes, confirm nothing remains:
terraform showThis should output an empty state:
No state.You can also verify in the AWS console or CLI that the resources no longer exist:
aws s3api list-buckets --query "Buckets[?contains(Name, 's3vec-rag')]"aws lambda list-functions --query "Functions[?contains(FunctionName, 's3vec-rag')]"Both commands should return empty arrays ([]).
Cost after teardown
Section titled “Cost after teardown”Once all resources are destroyed, there are no ongoing AWS charges for this demo. The project uses only pay-per-use services — with no resources provisioned, your bill is zero.
Partial cleanup
Section titled “Partial cleanup”If you want to keep some resources while removing others, use Terraform’s targeted destroy:
# Remove only the Amplify app (stop hosting the UI)terraform destroy -target=aws_amplify_app.this
# Remove only the EventBridge schedule (stop daily ingestion)terraform destroy -target=aws_scheduler_schedule.ingestNext steps
Section titled “Next steps”- Troubleshooting — if destroy fails or resources remain
- Terraform Apply — redeploy the stack from scratch