Terraform Apply
This page walks through the complete deployment process — from cloning the source repo to verifying your running application. The entire stack deploys in a single Terraform
HashiCorp Terraform — infrastructure-as-code tool used to provision all AWS resources in this demo. apply that takes around 3–5 minutes.
Clone the source repo
Section titled “Clone the source repo”Start by cloning the infrastructure repository:
git clone https://github.com/jajera/terraform-aws-s3-vectors-rag-demo.gitcd terraform-aws-s3-vectors-rag-demoConfigure terraform.tfvars
Section titled “Configure terraform.tfvars”Copy the example variables file and edit it with your values:
cp terraform.tfvars.example terraform.tfvarsOpen terraform.tfvars in your editor and set the required variables:
project = "s3vec-rag"environment = "dev"aws_region = "us-east-1"cognito_admin_email = "you@example.com"
rss_feeds = [ "https://aws.amazon.com/about-aws/whats-new/recent-announcements/feed/",]Variable reference
Section titled “Variable reference”| Variable | Required | Description |
|---|---|---|
project | Yes | Name prefix for all AWS resources (keep short, lowercase, no spaces) |
environment | Yes | Deployment environment label (e.g., |
aws_region | Yes | AWS region — must support both S3 Vectors Amazon Bedrock — a fully managed service for accessing foundation models (embedding and LLM) via a unified API. |
cognito_admin_email | Yes | Email for the auto-created admin user in Cognito |
rss_feeds | Yes | List of RSS feed URLs to ingest into the vector store |
ingest_schedule_expression | No | EventBridge |
embedding_model_id | No | Embedding model |
inference_profile_id | No | Bedrock inference profile for the LLM (default: Claude via cross-region profile) |
Initialize Terraform
Section titled “Initialize Terraform”Download the required providers and modules:
terraform initYou should see output confirming the AWS provider was installed:
Initializing provider plugins...- Installing hashicorp/aws v6.x.x...- Installing hashicorp/random v3.x.x...- Installing hashicorp/null v3.x.x...
Terraform has been successfully initialized!Preview the plan
Section titled “Preview the plan”Before applying, review what Terraform will create:
terraform planThis shows the full list of resources to be provisioned without making any changes. Expect around 40–50 resources including Lambda
AWS Lambda — serverless compute. This project uses two functions: ingest (RSS → embed → store) and query (search → answer). functions, API Gateway
Amazon API Gateway — a managed HTTP API service with JWT authorization, CORS, and throttling. Routes requests to the Query Lambda. routes, IAM roles, and the Amplify
AWS Amplify — a managed hosting service for static web applications. Used to host the briefing UI SPA. app.
Apply the configuration
Section titled “Apply the configuration”Deploy the entire stack:
terraform applyType yes when prompted to confirm. The deployment takes approximately 3–5 minutes.
What happens during apply
Section titled “What happens during apply”Terraform provisions resources in this sequence:
- Foundation — IAM roles, S3 buckets, vector bucket
A specialized S3 bucket type (aws_s3vectors_vector_bucket) that hosts vector indexes for similarity search. , and vector index
A named index (aws_s3vectors_index) within a vector bucket defining dimension, distance metric, and data type. - Compute — Lambda functions for ingest and query, with Python dependencies packaged as layers
- API layer — API Gateway HTTP API with JWT authorizer and CORS configuration
- Auth — Cognito user pool, app client, admin user, and user groups
- Frontend — Amplify app with the React SPA built and deployed
- Scheduling — EventBridge rule for daily ingest cron
- Bootstrap — A
null_resourceprovisioner triggers the initial ingest, embedding ~120 articles into the vector store
Verify outputs
Section titled “Verify outputs”Once the apply finishes, retrieve the key outputs:
terraform outputThis prints all configured outputs. To get individual values:
terraform output -raw app_urlterraform output -raw api_endpointterraform output -raw cognito_user_pool_idOutput reference
Section titled “Output reference”| Output | Description |
|---|---|
app_url | Amplify HTTPS URL for the web UI — open this in your browser |
api_endpoint | API Gateway base URL for the query and ingest endpoints |
cognito_user_pool_id | Cognito user pool ID (needed for CLI user management) |
cognito_client_id | SPA client ID used by the frontend for authentication |
vector_bucket_name | The S3 Vectors bucket name (useful for debugging) |
ingest_function_name | Ingest Lambda function name (for manual invocations or log inspection) |
Next steps
Section titled “Next steps”- Set up additional users — create readers and manage groups
- Explore the web UI — understand the frontend and redeployment
- Tear down the stack — clean up all resources when done