AWS shows how to secure a RAG support bot on Aurora PostgreSQL using eight responsible AI principles
A support chatbot searches old tickets that contain names, phone numbers and order data, and it can reveal too much or make up a fact. AWS showed how to address the risks on Aurora PostgreSQL across eight responsible AI principles and walked through one of them in detail: explainability. Every answer is written to a log along with the retrieved fragments, similarity scores and citations. That way, a plain SQL query answers the question "why did the bot say that?"
AI-processed from AWS Machine Learning Blog; edited by Hamidun News
Imagine a support bot that, when asked "Why is my last bill so high?", first searches for similar old tickets and knowledge base articles, then writes an answer based on them. This setup is called RAG: the model answers not from memory but from retrieved documents.
It is fast, but it has two problems. The tickets contain names, phone numbers and order details, so the bot may expose data it shouldn't. And if an answer is made up, nobody can tell where it came from.
AWS has published a guide proposing to solve this directly at the level of the Amazon Aurora PostgreSQL database. This is the first part of a series, and only one of the eight principles is covered in detail.
The eight responsible AI principles and database features
AWS draws on eight dimensions of responsible AI from the Well-Architected Responsible AI Lens, Bedrock Guardrails and the Responsible Use of AI Guide. For each one, the article includes a table of specific tools. Here is how it applies to a support bot.
- Fairness. Answers should be equally good regardless of language, region or customer profile. Testing requires diverse test queries, metadata filters and multilingual tests.
- Explainability. Users and support staff should understand why the bot answered the way it did. To do this, the system logs the retrieved fragments, similarity scores and citations.
- Privacy and security. Personal data is masked before vectors are created. In addition, Row-Level Security, encryption, roles and IAM are applied.
- Output safety. Content filters, banned topics, protection against prompt injection and request rate limiting, mostly through Bedrock Guardrails.
- Controllability. Handoff of the conversation to a human, a feedback table, feature flags and an emergency kill switch.
- Factuality and robustness. The answer is tied to the retrieved data and a similarity threshold, and document versions are checked with CHECK constraints and triggers.
- Governance. An audit log via pgaudit, retention periods via pg_cron, an archive in Amazon S3 and tracking of model versions.
- Transparency. The user sees that they are talking to AI and receives the sources of the answer.
How explainability works
First, documents are cleaned of personal data and converted into vectors, that is, numerical "fingerprints" of meaning. This is handled by the Aurora ML function aws_bedrock.invoke_model_get_embeddings with the Amazon Titan Text Embeddings V2 model (1,024 dimensions). The vectors are stored by the pgvector extension. Everything happens inside the database, with no separate ETL pipeline: Aurora ML calls Bedrock models and SageMaker endpoints directly from SQL.
Next, the path of a question. It arrives through API Gateway into Lambda and is turned into a vector by the same model used for the knowledge base, since otherwise the vectors cannot be compared. Aurora finds the nearest fragments by cosine distance and returns them with similarity scores. Row-Level Security leaves only the current tenant's data. Lambda assembles the prompt and labels each fragment as [Source N]. Guardrails check the input (content filters, banned topics, personal data), the model writes the answer, and a contextual grounding check confirms that the answer is based on the sources.
The key step comes last. Lambda writes to the chat_interactions table the question, the IDs of the retrieved fragments, their similarity scores, the sources actually cited, the Guardrails trace and the model ID. That is why a plain SQL query answers the question "why did the bot say that?" Old pg_cron records are archived to Amazon S3, logs and metrics go to CloudWatch, and API calls for audit are recorded by CloudTrail.
Limitations and what to choose
The authors note upfront that the table of approaches consists of examples, that they depend on the task, and that the series so far covers only one area. The versions of pgvector, Aurora ML and Bedrock model support are updated independently, so minimum versions should be checked against the documentation. You also need a cluster parameter group with pgaudit and pg_cron (requiring a cluster restart), along with IAM roles for Bedrock and S3.
There is also a choice between a ready-made and a custom-built solution. Amazon Bedrock Knowledge Bases already provides RAG with citations and is simpler if its standard behavior is enough. A custom scheme makes sense when the origin of answers must be stored in-house. In that case, you can distinguish retrieved sources from cited ones, store similarity scores and Guardrails traces, query them via SQL and manage them under your own rules.
The practical takeaway for teams whose data already lives in Postgres: it is cheaper to build answer verifiability into the data schema from the start. Investigating customer complaints without logs costs far more. AWS promises to cover the remaining seven principles in upcoming parts.
- Dec 2, 2026Amazon Releases Ergo Open Weights for Coding: 1.1 Trillion Parameters and 2,200 Tokens per Second
- Dec 2, 2026Tacit, a Startup With $93.5 Million in Funding, Built Earbuds for Silent Text Input
- Dec 2, 2026Amazon to Speed Up Ergo From 400 to 2,200 Tokens per Second and Buy 2 Million More Nvidia GPUs
- Dec 2, 2026Amazon Releases Ergo: US Open Model Closes the Gap With GPT-6.1 Terra at 38 Points
Key Questions Answered
What are the key details on The eight responsible AI principles and database features?
AWS draws on eight dimensions of responsible AI from the Well-Architected Responsible AI Lens, Bedrock Guardrails and the Responsible Use of AI Guide. For each one, the article includes a table of specific tools. Here is how it applies to a support bot. Fairness. Answers should be equally good regardless of language, region or customer profile. Testing requires diverse test queries, metadata filters and multilingual tests. Explainability.
How explainability works?
First, documents are cleaned of personal data and converted into vectors, that is, numerical "fingerprints" of meaning. This is handled by the Aurora ML function aws_bedrock.invoke_model_get_embeddings with the Amazon Titan Text Embeddings V2 model (1,024 dimensions). The vectors are stored by the pgvector extension. Everything happens inside the database, with no separate ETL pipeline: Aurora ML calls Bedrock models and SageMaker endpoints directly from SQL. Next, the path of a question.
What are the key details on Limitations and what to choose?
The authors note upfront that the table of approaches consists of examples, that they depend on the task, and that the series so far covers only one area. The versions of pgvector, Aurora ML and Bedrock model support are updated independently, so minimum versions should be checked against the documentation. You also need a cluster parameter group with pgaudit and pg_cron (requiring a cluster restart), along with IAM roles for Bedrock and S3. There is also a choice between a ready-made and a custom-built solution.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
