Data and retrieval
Retrieval-augmented generation (RAG) brings enterprise information into a model's context before it answers. A policy assistant, for example, searches approved documents and cites the passages behind its response. Protecting that information requires controls for source storage, ingestion, indexes, and any copies retained in conversation history.
This section of the guide explains those controls alongside the model inference guidance
Security considerations
A shared retrieval identity can expose documents that the requesting user cannot read.
Untrusted documents can introduce unauthorized instructions or affect the accuracy of later responses.
Copies in indexes, caches, and memory can remain accessible after source access changes.
Broad ingestion permissions can admit protected or unreviewed content into a knowledge base.
Infrastructure security
Knowledge bases and vector storage
Amazon Bedrock Knowledge Bases retrieves enterprise content and can include citations in generated responses. For a design using Amazon Simple Storage Service (Amazon S3) and a customer-managed vector store, keep source documents in a protected S3 bucket and limit ingestion to an approved pipeline. Give the knowledge base service role access to that source, the selected embedding model, and its vector index. Other knowledge base types and connectors need permissions for their own data sources.
Amazon OpenSearch Serverless provides a vector-store option with separate encryption, network, and data access policies. Together, these policies govern how data is encrypted, how clients connect, and which operations they can perform. Configure all three, with index writes restricted to approved ingestion identities and reads restricted to the retrieval service. Private connectivity alone does not authorize a reader. Review overlapping policies and alternate search endpoints that could bypass application authorization.
Grant the required AWS Identity and Access Management (IAM) data-plane permissions as well; a data access policy alone is insufficient.
Keep unreviewed uploads in a staging bucket, separate from the S3 source bucket available for ingestion. Enable S3 Block Public Access on both buckets and permit promotion only through the ingestion pipeline. Use Amazon GuardDuty Malware Protection for S3 to scan uploads, and promote only the object version whose scan completed with NO_THREATS_FOUND. Keep pending, failed, unsupported, and threat-positive objects out of the ingestion source. When using scan-result tags to control access, prevent other principals from setting or changing the GuardDuty result tag.
Validate document type, source, and permitted use before promotion; a malware scan does not validate those properties. Quarantine rejected files. Isolate document-processing compute from unrelated workloads and limit its outbound destinations and storage access.
Identity and data security
Authorization and classification
Establish a user's document permissions before the application searches the knowledge base. The Knowledge Bases retrieval filter is optional in the API. When using metadata for authorization, require trusted backend code to construct the filter from verified identity and protect the metadata it evaluates. Restrict direct retrieval access so that callers cannot omit or replace this filter. Don't use a model-generated relevance filter to establish access rights. Reject requests with missing authorization context; see the retrieval scope example
Ingestion credentials can read documents that an individual end user cannot. Ingestion permission does not establish retrieval entitlement. For example, the customer-managed Confluence connector does not preserve source access restrictions for callers with retrieval permission. Apply the backend authorization above to existing deployments using that connector.
Check each connector's documented behavior. The Salesforce connector for Amazon Bedrock Managed Knowledge Base can synchronize document access control lists (ACLs) and check access at query time. The application must authenticate users and supply verified identity context. This filtering is not a security boundary and does not enforce Salesforce field-level security. Validate the selected connector's permissions and revocation behavior before relying on it.
Give ingestion and retrieval separate IAM roles scoped to their required resources. Use AWS KMS customer managed keys where the selected knowledge base resources require customer control of encryption. Coordinate key policies with Amazon S3 and vector-store permissions. Require Transport Layer Security (TLS) on each data path. Classify chunks, embeddings, exports, and stored prompts according to the information they contain.
Apply the shared data classification controls
Provenance, memory, and deletion
Correcting or removing a source document can require changes to its derived chunks and indexes. The application needs lineage records linking source versions to those transformations so that the team can identify affected content. AWS Glue Data Catalog can help organize source datasets, while the application records the RAG transformations beyond the catalog. Restrict catalog changes to data owners and approved pipelines, and assign owners to approve additions, corrections, and removal of poisoned or obsolete content.
Amazon Bedrock AgentCore Memory retains conversation events and extracted context when the application needs continuity. Authorize access to actor, session, and namespace identifiers using trusted user context. Define retention for events and long-term records separately, and include memory in deletion handling when it contains retrieved data.
Reconcile source updates and deletions with ingestion completion and subsequent retrieval tests. Deleting a Knowledge Bases data source follows its configured deletion policy and does not delete the vector store itself. Account for failed deletion, retained Amazon S3 object versions, caches, citations, logs, and backups. Document legal retention exceptions and prevent removed content from reappearing through later ingestion.
AI application security
In the Amazon Bedrock Knowledge Bases retrieval-and-generation flow, Amazon Bedrock Guardrails evaluates the input and generated response, not the retrieved references. Enforce retrieval authorization before generation and separately validate content admitted to the index. A response filter cannot repair an unauthorized retrieval.
Include custom ingestion, retrieval, and caching code in the application code review workflow
Protect retrieved context and observe data access
Retrieved text, metadata, and extracted document content can contain instructions intended to redirect the model. Treat them as untrusted input, preserve source attribution, and separate the content from application instructions. Apply Guardrails to selected content paths after checking inspection coverage. Evaluate poisoned documents, misleading citations, and unsupported answers alongside retrieval quality.
Collect ingestion logs and application retrieval metrics in Amazon CloudWatch, and configure alarms for failures. Correlate these with AWS CloudTrail records. Enable Knowledge Bases data events for Retrieve and RetrieveAndGenerate, and S3 data events for access to the source documents that require auditing. Keep query text and retrieved content out of routine logs unless investigation requirements justify retaining them. Apply the shared detection controls
Design considerations
Choose whether tenants share a knowledge base and vector index or use separate knowledge bases, based on data sensitivity and contractual or regulatory requirements. Enforce each user's document permissions on each retrieval path. Define acceptable ingestion lag and revocation delay. Test access denial and deletion under partial failures, and retain provenance metadata, such as source document identifiers and versions, to identify affected answers without copying the corpus into logs.