Deployment
A single terraform apply provisions the entire stack — storage, compute, auth, and hosting — in roughly 3–5 minutes. This page explains what happens during that deploy and the order resources are created.
Deployment timeline
Section titled “Deployment timeline” Terraform
HashiCorp Terraform — infrastructure-as-code tool used to provision all AWS resources in this demo. resolves resource dependencies automatically and
creates things in parallel where possible. The overall apply takes 3–5 minutes, with most of
that time spent on the bootstrap ingest and web UI deployment.
| Phase | Duration | What happens |
|---|---|---|
| 1. Foundation | ~30s | IAM roles, CloudWatch log groups, S3 bucket, S3 Vectors bucket + index |
| 2. Compute + Auth | ~30s | Lambda functions (ingest + query), Cognito user pool + client, API Gateway |
| 3. Scheduling + Hosting | ~15s | EventBridge schedule, Amplify app resource |
| 4. Bootstrap ingest | ~60–90s | Lambda invocation: fetches RSS, embeds ~120 articles, stores vectors |
| 5. Web UI deploy | ~60–90s | Builds React app with config injection, deploys to Amplify |
Resource creation order
Section titled “Resource creation order”Terraform’s dependency graph determines creation order. Here’s how the resources relate:
Phase 1 — Foundation
Section titled “Phase 1 — Foundation”These have no dependencies and are created first:
- IAM roles and policies — Least-privilege roles for both Lambda
AWS Lambda — serverless compute. This project uses two functions: ingest (RSS → embed → store) and query (search → answer). functions - CloudWatch log groups — Log retention for Lambda executions
- S3 bucket — Stores raw article content and web app assets
- S3 Vectors bucket — The vector bucket
A specialized S3 bucket type (aws_s3vectors_vector_bucket) that hosts vector indexes for similarity search. that hosts the vector index - S3 Vectors index — The vector index
A named index (aws_s3vectors_index) within a vector bucket defining dimension, distance metric, and data type. (1024 dimensions, cosine, float32)
Phase 2 — Compute and Auth
Section titled “Phase 2 — Compute and Auth”Depends on IAM roles and the vector index being ready:
- Ingest Lambda — Python function that fetches, embeds, and stores articles
- Query Lambda — Python function that searches vectors and generates answers via Bedrock
Amazon Bedrock — a fully managed service for accessing foundation models (embedding and LLM) via a unified API. - Cognito
Amazon Cognito — a user authentication service providing user pools, JWT tokens, and group-based authorization. user pool — Authentication with auto-created admin user - Cognito app client — OAuth2 settings for the web UI
- API Gateway
Amazon API Gateway — a managed HTTP API service with JWT authorization, CORS, and throttling. Routes requests to the Query Lambda. HTTP API — Routes with JWT authorizer pointing to Query Lambda
Phase 3 — Scheduling and Hosting
Section titled “Phase 3 — Scheduling and Hosting”Depends on Lambda functions and Cognito:
- EventBridge
Amazon EventBridge — a serverless event bus. Used here for the daily scheduled corpus ingest cron trigger. schedule — Daily cron trigger for the ingest Lambda - Amplify
AWS Amplify — a managed hosting service for static web applications. Used to host the briefing UI SPA. app — Hosting resource for the web UI SPA
Phase 4 — Bootstrap ingest
Section titled “Phase 4 — Bootstrap ingest”Triggered by an aws_lambda_invocation resource that depends on the ingest Lambda and vector index:
- Invokes the ingest function with an empty payload
- The function fetches AWS announcements via RSS feeds
- Each article is embedded using Titan Embeddings V2
Amazon Titan Embeddings V2 (amazon.titan-embed-text-v2:0) — converts text into 1024-dimensional vectors for similarity search. - Vectors are stored via PutVectors
S3 Vectors PutVectors API — stores one or more vectors with associated metadata in a vector index. with metadata (title, URL, date, feed) - Result: ~120 articles indexed and searchable
Phase 5 — Web UI deploy
Section titled “Phase 5 — Web UI deploy”A null_resource with a local-exec provisioner runs the deploy-web.sh script:
- Injects Cognito and API Gateway outputs into the React app config
- Builds the production bundle
- Deploys the built assets to Amplify
What you see in the terminal
Section titled “What you see in the terminal”During terraform apply, expect output like:
aws_iam_role.ingest: Creating...aws_s3vectors_vector_bucket.this: Creating...aws_s3vectors_vector_bucket.this: Creation complete after 3saws_s3vectors_index.this: Creating...aws_s3vectors_index.this: Creation complete after 5saws_lambda_function.ingest: Creating...aws_lambda_function.query: Creating...aws_cognito_user_pool.this: Creating......aws_lambda_invocation.bootstrap: Creating...aws_lambda_invocation.bootstrap: Still creating... [1m0s elapsed]aws_lambda_invocation.bootstrap: Creation complete after 1m23snull_resource.deploy_web: Creating...null_resource.deploy_web: Provisioning with 'local-exec'...null_resource.deploy_web: Still creating... [1m0s elapsed]null_resource.deploy_web: Creation complete after 1m35s
Apply complete! Resources: 22 added, 0 changed, 0 destroyed.After deployment completes
Section titled “After deployment completes”Once terraform apply finishes, you have:
- A fully populated vector index with ~120 embedded articles
- A live API endpoint (API Gateway URL in Terraform outputs)
- An authenticated web UI accessible via the Amplify URL
- A daily schedule that keeps the corpus fresh via EventBridge
- An admin user auto-created in Cognito (credentials in Terraform outputs)
The next steps cover the terraform apply commands in detail, Cognito user management, and the web UI configuration.