How to Build a Claude‑Powered RAG Chatbot Over Aurora Serverless v2 PostgreSQL, Explained Simply A developer published a guide for building a Node.js retrieval-augmented generation (RAG) chatbot that grounds Claude's answers in data stored in Aurora Serverless v2 PostgreSQL, using the pgvector extension for semantic search alongside SQL filters and joins. The walkthrough covers provisioning a Serverless v2 cluster via the AWS SDK with a 0.5–4 ACU scaling range, adding pgvector's vector column type and similarity operators, and using RDS Proxy to avoid exhausting database connections from Lambda or containers. You can’t rely on a flat vector store when your data lives in relational tables. By the end of this guide you’ll have a live Node.js service that pulls context from Aurora Serverless v2, crafts a prompt, and lets Claude answer like it’s reading the docs straight from your database. RAG – short for Retrieval‑Augmented Generation – is the pattern of first looking up relevant information and then feeding it to a language model so the answer is grounded in reality. In plain English: RAG is like asking a friend to look up a fact in a cookbook before they reply to your dinner‑question. A vector store holds dense numeric representations vectors of text and lets you find “similar” items quickly. It’s great when every piece of knowledge lives in a single blob e.g., a PDF . But most production data lives in relational tables : rows, columns, foreign keys, timestamps, and sometimes millions of small records. Imagine you have a products table with id , name , category , price , and description . You want answers that respect the current price, the active promotion flag, and the user’s locale. A plain vector store would force you to denormalize all that logic into a single text field, losing the ability to filter or sort with SQL. Key takeaway: Keeping the data in a relational engine lets you combine the power of SQL filters, joins, transactions with the semantic search that vectors provide. Think of a vector store as a photo album where you can quickly find pictures that look similar. A relational database is a well‑indexed library catalog where you can ask very specific questions like “books published after 2015 by authors from Canada”. When you need both visual similarity and precise constraints, you want a hybrid approach – exactly what Aurora Serverless v2 with the pgvector extension gives you. Use the AWS console or the @aws-sdk/client-rds package. Below is a minimal TypeScript snippet that launches a Serverless v2 cluster with the PostgreSQL engine. js import { RDSClient, CreateDbClusterCommand, CreateDbInstanceCommand, } from "@aws-sdk/client-rds"; // The RDS client will use the default credentials chain env vars, profile, etc. const rds = new RDSClient { region: "us-east-1" } ; async function createAuroraCluster { // Step 1 – create the cluster no instances yet await rds.send new CreateDbClusterCommand { // Engine name for PostgreSQL Engine: "aurora-postgresql", // Serverless v2 is selected by setting the DBClusterParameterGroupName // that enables the ACU scaling mode. DBClusterIdentifier: "rag-demo-cluster", MasterUsername: "admin", MasterUserPassword: "SuperSecret123 ", // use Secrets Manager in real life // Minimum ACU Aurora Capacity Unit of 0.5 keeps the bill low. ScalingConfiguration: { MinCapacity: 0.5, MaxCapacity: 4, // can burst higher if needed }, } ; // Step 2 – create a single writer instance attached to the cluster await rds.send new CreateDbInstanceCommand { DBInstanceIdentifier: "rag-demo-instance", DBClusterIdentifier: "rag-demo-cluster", Engine: "aurora-postgresql", DBInstanceClass: "db.serverless", } ; console.log "Aurora Serverless v2 cluster created." ; } Why this matters: ACU – Aurora Capacity Unit – is the unit of compute you pay for. The minimum of 0.5 means you can keep monthly cost around $50 even when idle, but you must remember that it’s a floor, not a zero. RDS Proxy – a managed connection pool that sits between your Node.js code and the database. Without it, each Lambda or container opens a new TCP socket, quickly exhausting the few connections Aurora Serverless v2 allows. pgvector extension pgvector adds a column type vector and similarity operators <- that let PostgreSQL compute cosine similarity directly. -- Connect with psql or any SQL client CREATE EXTENSION IF NOT EXISTS vector; Tip: The extension must be installed in each database you intend to query. After a snapshot restore you may need to run the command again because the extension isn’t always persisted. CREATE TABLE products id SERIAL PRIMARY KEY, name TEXT NOT NULL, category TEXT NOT NULL, price NUMERIC 10,2 NOT NULL, description TEXT, -- The embedding column stores a 1536‑dimensional float vector Claude's embedding size embedding VECTOR 1536 NOT NULL ; VECTOR 1536 tells PostgreSQL the column will hold a fixed‑length array of 1536 numbers. In plain English: The embedding column is a list of numbers that captures the meaning of the product description, so the database can compare it to other lists and decide which ones are “close”. Anthropic’s Claude lives behind AWS Bedrock , a managed inference service. The SDK package @aws-sdk/client-bedrock-runtime gives us a thin wrapper around the HTTP API. npm install @aws-sdk/client-bedrock-runtime Claude expects a prompt in a JSON payload. The InvokeModelCommand sends the payload and returns a streamed response. Below is a minimal wrapper that hides the streaming details and returns the plain text answer. js import { BedrockRuntimeClient, InvokeModelCommand, } from "@aws-sdk/client-bedrock-runtime"; / Sends a prompt to Claude and returns the generated answer. @param prompt - The full text you want Claude to complete. / export async function askClaude prompt: string : Promise