Home icon

Access control for vector stores using metadata filtering with Amazon Bedrock Knowledge Bases

Machine Learning Blog



This article discusses how to implement access control and ensure data privacy and security in applications that use Retrieval Augmented Generation (RAG) with Knowledge Bases for Amazon Bedrock. It demonstrates how to leverage metadata filtering to restrict the search and retrieval of data based on user roles, departments, or data sensitivity levels.

Specifically, the article covers:

  • The benefits of metadata filtering for access control in RAG applications
  • A healthcare provider use case where doctors can only access transcripts of their own patient interactions
  • Setting up user authentication with Amazon Cognito and associating doctors with patient IDs in Amazon DynamoDB
  • Structuring the dataset with transcript files and corresponding metadata JSON files
  • Creating a knowledge base and using metadata filters in the Amazon Bedrock console
  • Querying the knowledge base programmatically with metadata filters using the AWS SDK
  • Building a Streamlit app as a user interface for doctors to interact with the knowledge base
  • Cleaning up and deleting the deployed resources


Go to article

The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.

Related articles

Jul 18
2024
Metadata filtering for tabular data with Amazon Bedrock Knowledge Bases
Oct 11
2024
Dive deep into vector data stores using Amazon Bedrock Knowledge Bases
Apr 8
2024
Amazon Bedrock Knowledge Bases now supports metadata filtering to improve retrieval accuracy
Mar 27
2025
Amazon Bedrock Knowledge Bases now supports Amazon Opensearch Managed Cluster for vector storage

The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.