Designing Retrieval Augmented Generation with Bedrock Knowledge Bases
This lesson explains how RAG works, the ingestion choices for chunking and vector stores, and the retrieval settings that decide answer quality and access control.
Learning outcomes
After completing this lesson, you will be able to:
- Explain the ingestion and retrieval flows of a RAG system.
- Choose a chunking strategy and a vector store for a set of documents.
- Identify retrieval settings that fix common quality and access problems.
How RAG works
A RAG system has two flows. Ingestion splits documents into chunks, turns each chunk into a vector with an embeddings model and stores the vectors with their text and metadata in a vector store. Retrieval turns the user's question into a vector, finds the most similar chunks, and passes them to the generation model in the prompt, which answers from them and cites them. Because the documents are retrieved at query time, the answer reflects the latest synchronised content, and the model's training data does not need to change.
Bedrock Knowledge Bases manage both flows. Data sources include S3, Confluence, SharePoint, Salesforce and web crawlers; an ingestion job (run on demand or on a schedule) parses, chunks and embeds new and changed documents. The Retrieve API returns relevant chunks for the application to use, and RetrieveAndGenerate also produces the answer with citations.
The following diagram shows the ingestion and retrieval flows meeting at the vector store.

Ingestion choices
Chunking
Fixed-size chunking splits text into chunks of a set token count with overlap; it is simple but can split related content. Semantic chunking groups sentences by meaning. Hierarchical chunking stores small child chunks for precise matching and returns their larger parent chunks as context. Documents with tables and images benefit from advanced parsing, which extracts their structure before chunking.
Vector stores
Knowledge Bases can create or use Amazon OpenSearch Serverless (low-latency, high-throughput search with hybrid keyword and semantic matching), Aurora PostgreSQL with pgvector (when the team already runs Aurora or needs SQL joins), Amazon S3 Vectors (lowest cost for very large, less frequently queried vector sets with subsecond queries) and other supported stores. The embeddings model and the vector store must stay in the same Region as the knowledge base.
Which vector store?
Retrieval choices
Retrieval quality is tuned with the number of results, hybrid search that combines keyword and semantic matching, metadata filters that restrict results to documents matching attributes such as department, product or date, reranking models that reorder results by relevance, and query decomposition that splits complex questions. Metadata filters are also the way to enforce document-level access: the application sets the filter from the authenticated user's claims, so users only retrieve documents they are entitled to.
The following table maps common RAG problems to the setting that fixes them.
| Problem | Likely fix |
|---|---|
| Answers miss details split across chunks | Semantic or hierarchical chunking |
| Relevant passages retrieved but ranked low | Reranking model |
| Users see other departments' documents | Metadata filter from the user's claims |
| Answers quote outdated text | Scheduled or event-driven ingestion (sync) jobs |
| Answers not supported by the sources | Guardrail contextual grounding check |
Fixing RAG problems
A policy assistant for a global company
A company with offices in 30 countries wants an assistant that answers HR questions from about 20,000 policy documents in S3, shows sources, and never shows one country's policies to employees of another.
The architect creates a knowledge base on the bucket with hierarchical chunking and OpenSearch Serverless, adds a country metadata field to each document, and schedules a nightly ingestion job.
The application calls RetrieveAndGenerate with a metadata filter built from the country claim in the employee's identity token, and a guardrail with contextual grounding checks blocks answers that the retrieved policies do not support. When the company later asks the assistant to book leave, that is an action, so it becomes a tool for an agent with human confirmation rather than a change to the knowledge base.
Documents in a knowledge base's data source changed yesterday, but answers still quote the old text. Why?
Show answer
Changes are reflected only after an ingestion (sync) job processes the data source again. Scheduling the sync, or triggering it when documents change, keeps the vector store current.
Exam Tips
Remember for the exam
- Private, frequently changing documents without retraining: RAG with a knowledge base and scheduled sync.
- Document-level access control in RAG: metadata filters set from the user's identity.
- Very large vector sets at lowest cost: S3 Vectors; low latency and hybrid search: OpenSearch Serverless.
- Relevant chunks ranked too low: add a reranking model.