
From Documents to Knowledge: Getting Started with Amazon Bedrock Knowledge Bases
Learn how to connect your own documents to generative AI using Amazon Bedrock Knowledge Bases and build the foundation for Retrieval-Augmented Generation (RAG).
Introduction
Large language models (LLMs) can explain concepts, generate code, and answer questions across many topics. However, what happens when we need an AI application to answer questions about our own documents, internal procedures, or technical manuals?
A general-purpose model may not have access to that information. Even when it produces a convincing answer, it may provide outdated or incorrect details.
One approach to this problem is Retrieval-Augmented Generation (RAG). Instead of relying exclusively on the information learned during training, a RAG application retrieves relevant content from an external knowledge source and uses it as context when generating a response.
Amazon Bedrock Knowledge Bases helps developers implement this pattern without having to build every component of the retrieval pipeline from scratch.
In this article, we will explore how Knowledge Bases work and create a simple technical-support knowledge base using Amazon S3 as our document source.
By the end, you will understand how to prepare documents, connect a data source, synchronize content, and test whether the retrieved information supports your use case.
1. What is Amazon Bedrock Knowledge Bases?
Amazon Bedrock Knowledge Bases is an AWS capability that connects foundation models and generative AI applications to information stored in external data sources.
It provides functionality for ingesting data, retrieving relevant information, and supplying that information to generative AI applications.
For unstructured documents, a traditional RAG workflow typically involves several operations:
- Reading and processing source documents.
- Splitting their content into smaller, manageable chunks.
- Generating numerical representations called embeddings.
- Indexing those representations for retrieval.
- Retrieving relevant content when a user submits a query.
Amazon Bedrock Knowledge Bases automates much of this process, reducing the amount of infrastructure and retrieval logic developers need to implement themselves.
For more details, see the official Amazon Bedrock Knowledge Bases documentation .
Understanding RAG
RAG stands for Retrieval-Augmented Generation. It combines two main capabilities: retrieving relevant information and generating a response using that information.
Consider a company that wants an AI assistant to answer questions about its technical-support procedures. The procedures are stored in documents that a general-purpose model cannot automatically access.
With RAG, the application can retrieve the relevant sections of those documents and provide them to a language model as context.
The model can then generate an answer informed by the retrieved content.
This is useful because updating the source documents and synchronizing the knowledge base can make new information available without retraining the foundation model.
However, RAG does not guarantee that every answer will be correct. The quality of the result depends on the source documents, retrieval quality, query, and model behavior.
2. How does a Knowledge Base work?
A useful way to understand Knowledge Bases is to separate the process into two stages: ingestion and retrieval.
Stage 1: Data ingestion
Before the application can retrieve information, the source documents must be processed.
For an unstructured document workflow, the process generally involves:
- Connect a data source: Identify where the original documents are stored.
- Parse the content: Extract information from the supported document formats.
- Split the content into chunks: Divide documents into smaller sections suitable for retrieval.
- Generate embeddings: Represent the content numerically so that semantic similarity can be evaluated.
- Index the content: Store the representations and the information needed to retrieve the original content.
Once ingestion finishes successfully, the knowledge base can be queried.
Stage 2: Retrieval and generation
When an application submits a question, the knowledge base searches for relevant information.
In a typical RAG workflow:
- The user submits a question.
- The system retrieves relevant document sections.
- Those sections are supplied as context to a language model.
- The model generates a response based on the question and the retrieved information.
Amazon Bedrock Knowledge Bases also supports retrieving source content separately from generating a response. This distinction is useful when developers want more control over how their applications use retrieved information.
You can explore the process in the official guide to how Knowledge Bases work .
3. Our example: A technical-support knowledge base
Let's put these concepts into practice.
Imagine that a company wants to make its internal technical-support procedures easier to consult. Instead of requiring employees to search through a manual, we want to create a knowledge base that can retrieve information about common problems.
For this exercise, we will use a Markdown document containing procedures for:
- Troubleshooting internet connectivity.
- Resolving a slow computer.
- Resetting a forgotten password.
- Requesting access to an application.
The goal is not to build a complete chatbot yet. First, we want to create and validate the knowledge layer that a future application could use.
Architecture
The initial architecture is deliberately simple:

Amazon S3 stores the original documents, while Amazon Bedrock Knowledge Bases processes and makes their content available for retrieval.
We can test the knowledge base directly before integrating it into a separate application.
4. Prepare the source document
Start by creating a file named
technical-support-v1.md.Add the following content:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Internal Technical Support Manual - Version 1
## Internet Connectivity Issues
If a user cannot connect to the internet:
1. Check that the network cable is connected
or that Wi-Fi is enabled.
2. Restart the network connection from the
operating system.
3. Check whether other users have the same issue.
4. If the problem persists, open a support ticket.
## Slow Computer
If a computer is running slowly:
1. Close applications that are not in use.
2. Restart the computer.
3. Check for pending updates.
4. Contact the support team if the issue continues.
## Forgotten Password
If a user forgets their password, they should
access the internal self-service portal and
select "Reset Password".
If they cannot access the portal, they should
contact the help desk.
## Application Access Requests
To request access to an application:
1. Open the internal request portal.
2. Select the required application.
3. Explain why access is needed.
4. Wait for approval from the direct manager.Save the file.
This example is intentionally small. Its purpose is to demonstrate the ingestion and retrieval workflow, not to represent a complete enterprise knowledge repository.
Document organization matters: descriptive headings, clear procedures, and consistent terminology can make information easier to retrieve and interpret.
5. Create an Amazon S3 bucket
Our first AWS resource will be an S3 bucket to store the source document.
- Sign in to the AWS Management Console .
- Open Amazon S3.
- Select Create bucket.
- Enter a globally unique bucket name, such as
technical-support-kb-your-name. - Select the AWS Region you intend to use for this exercise.
- Keep the bucket private and retain the appropriate security settings.
- Create the bucket.
- Open it and upload
technical-support-v1.md.
For this workshop, we will use US East (N. Virginia),
us-east-1, as the intended Region. Verify that the Knowledge Base configuration and other resources use compatible Regions and configurations.You can find more information in the Amazon S3 User Guide .
6. Create the Knowledge Base
Now we can connect the source document to Amazon Bedrock.
- Open Amazon Bedrock in the AWS Management Console.
- Navigate to Knowledge Bases.
- Select the option to create a Knowledge Base.
- Review the available creation options and select the managed Knowledge Base experience for this exercise, if available in your Region and account.
- Enter a name, such as
kb-technical-support-workshop. - Add a description, for example:
Knowledge base for internal technical-support procedures. - Configure the required permissions and service role.
- Select Amazon S3 as the data source.
- Choose the bucket containing your Markdown document.
- Review the configuration and create the Knowledge Base.
The managed experience is designed to simplify the underlying infrastructure and retrieval setup. Available features and configuration options can vary by Region and service updates, so follow the current console instructions.
For detailed prerequisites and configuration options, consult the official Knowledge Base creation guide .
What does AWS manage for us?
Depending on the selected configuration, Amazon Bedrock can manage important parts of the knowledge-base workflow, including document processing, embeddings, indexing, and retrieval capabilities.
Embeddings are numerical representations of content that help a retrieval system find information related to a query, even when the wording differs from the original document.
For example, a user might ask, "My laptop is really sluggish." The source document might use the heading "Slow Computer." Semantic retrieval can help identify that these expressions concern a similar issue.
This is one reason Knowledge Bases are useful for applications that must search natural-language documents.
7. Synchronize the data source
Creating the Knowledge Base does not necessarily mean that the source document is already ready for retrieval.
We must ensure that the document has been ingested successfully.
- Open the Knowledge Base you created.
- Navigate to its data sources.
- Select the Amazon S3 data source.
- Choose Sync.
- Wait for the synchronization process to finish.
- Verify that the operation completed successfully.
During ingestion, the service processes the source content and prepares it for retrieval.
An important concept is that the source document and the indexed knowledge are not automatically identical at every moment. If you modify the source, you must ensure that the changes are ingested according to the data source's synchronization workflow.
This is especially important when the source contains policies, troubleshooting instructions, or other information that changes over time.
8. Test the Knowledge Base
Once synchronization is complete, we can test retrieval from the AWS console.
Open the Knowledge Base testing interface and submit questions that can be answered using the source document.
Test 1: Internet connectivity
Question:
"What should I do if I cannot connect to the internet?"
A useful result should retrieve the relevant troubleshooting procedure, including checking the cable or Wi-Fi, restarting the connection, checking whether other users are affected, and opening a support ticket if the problem persists.
Test 2: Forgotten password
Question:
"I forgot my password. How can I recover access?"
The retrieved content should identify the internal self-service portal and the "Reset Password" procedure. It should also include the alternative of contacting the help desk if the portal is inaccessible.
Test 3: Application access
Question:
"How do I request permission to use an internal application?"
The relevant content should describe opening the request portal, selecting the application, explaining the need, and waiting for managerial approval.
The exact wording of retrieved results may differ from the original document. The important point is whether the retrieved information is relevant and supports the answer.
Where available, inspect the retrieved passages and source references rather than evaluating only the final generated response.
Test 4: A question outside the document
Question:
"What is the company's vacation policy?"
Our source document does not contain this information.
This test is just as important as the previous ones. A reliable application should not treat the existence of a Knowledge Base as evidence that every possible question can be answered.
Depending on the retrieval results and the application's instructions, the system should acknowledge that the available information is insufficient rather than inventing a company policy.
A response such as "I could not find sufficient information in the provided documents to answer that question" is a reasonable behavior to aim for, although it is not guaranteed automatically by the Knowledge Base itself.
9. Update the knowledge and synchronize again
One of the main advantages of a RAG architecture is that information can be updated independently of the foundation model.
Let's demonstrate this with a small change.
Create a new version of the document named
technical-support-v2.md and change the slow-computer procedure to:1
2
3
4
5
6
7
8
If a computer is running slowly:
1. Save your work.
2. Restart the computer.
3. Close unnecessary applications.
4. Contact the support team if the issue continues.Upload the updated document to the source bucket, replacing the previous version or updating the same source object as appropriate for your chosen workflow.
Then synchronize the data source again and wait for the operation to finish.
Repeat the question:
"My computer is running slowly. What should I do?"
The updated knowledge base should make the revised procedure available for retrieval.
This illustrates an important distinction: we are updating the external knowledge source, not retraining the language model. The new content becomes available through the ingestion and synchronization process.
For reliable results, verify that the previous version is no longer contributing conflicting information. Leaving multiple documents with contradictory instructions can make retrieval less consistent.
10. Best practices for building useful Knowledge Bases
Creating a Knowledge Base is only the beginning. Its usefulness depends heavily on the quality and organization of the underlying information.
Write for retrieval
Use descriptive titles, meaningful headings, and clear paragraphs. A well-organized document is generally easier to process and maintain than a collection of unstructured notes.
Keep information consistent
Avoid maintaining multiple documents that provide conflicting answers to the same question. Define a process for updating documents and removing obsolete versions.
Test realistic questions
Users rarely phrase questions exactly as they appear in a manual. Test variations, abbreviations, incomplete questions, and natural-language expressions.
For example:
- "My internet is down."
- "The Wi-Fi stopped working."
- "I can't get online."
These questions should lead to relevant connectivity guidance when the source content supports it.
Check retrieval quality separately from generation
A fluent answer does not necessarily mean that the correct document was retrieved.
Inspect the source passages, evaluate their relevance, and test whether the answer is supported by the evidence. If retrieval is poor, investigate the documents and ingestion configuration before assuming that changing the language model will solve the problem.
Define what happens when information is missing
A Knowledge Base cannot guarantee that every question has an answer. Applications should handle insufficient or irrelevant retrieval results appropriately and avoid presenting unsupported statements as established facts.
Consider security and cost
Keep source documents private unless public access is explicitly required. Configure IAM permissions according to least privilege, and review access to both the source documents and the Knowledge Base.
Also, review the current Amazon Bedrock pricing page . Managed features may include document parsing, managed embeddings, and reranking without separate charges, but storage, retrieval requests, model inference, and other enabled features can still incur costs.
Conclusion
Amazon Bedrock Knowledge Bases provides a practical foundation for connecting generative AI applications to external information.
In this exercise, we explored the core RAG workflow, created a technical-support document, stored it in Amazon S3, connected it to a Knowledge Base, synchronized the source, and tested questions both inside and outside the document's scope.
The most important lesson is that a useful RAG system is not simply a language model connected to a collection of files. It depends on well-prepared documents, appropriate retrieval, successful synchronization, and systematic testing.
Once the knowledge layer is working, it can serve as the foundation for a chatbot, an internal search tool, or another application that needs to answer questions using specific information.
In a follow-up article, we can extend this foundation by connecting the Knowledge Base to an application using AWS Lambda, Amazon API Gateway, and a web interface.
References
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article