c3.1 Encrypt the knowledge base and vector store with a CMK
Encrypt data ingestion jobs, the vector store, query sessions, and the S3 data sources with a customer managed KMS key, so RAG data is protected at rest and in transit.
Implementation guidance
How to implement on AWS
Configure the Bedrock knowledge base ingestion job, the OpenSearch Serverless vector store, and query sessions to use a customer managed KMS key. Encrypt the S3 data-source buckets and any Secrets Manager secrets with the same control, and require TLS 1.2+ in transit.
RAG data needs encryption at several points
A knowledge base moves your data through several stages, each a place data sits or transits: the S3 data sources, the data ingestion job that chunks and embeds them, transient storage Bedrock uses during ingestion, the vector store, and the query sessions at retrieval time. A customer managed KMS key (CMK) lets you bring all of these under a key whose access you control and audit, instead of relying on default AWS managed keys you cannot inspect.
Let Bedrock use your key
As with other Bedrock features, the key policy grants the service principal the needed operations, scoped to Bedrock with kms:ViaService:
{
"Sid": "AllowBedrockKnowledgeBaseUseOfKey",
"Effect": "Allow",
"Principal": { "Service": "bedrock.amazonaws.com" },
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:GenerateDataKey",
"kms:CreateGrant",
"kms:DescribeKey"
],
"Resource": "*",
"Condition": {
"StringEquals": { "kms:ViaService": "bedrock.us-east-1.amazonaws.com" }
}
}
Encrypt each stage, not just one
- Data sources: enable SSE-KMS with this CMK on the S3 bucket holding the source documents.
- Transient data during ingestion: pass the CMK when you create the data source / ingestion configuration so Bedrock encrypts intermediate data with your key.
- Vector store: encrypt the OpenSearch Serverless collection (or your chosen store) with a CMK — configured on the store itself.
- Query sessions: supply a CMK for the session data at retrieval time so prompts and retrieved context are encrypted with your key.
A chain is only as strong as its weakest link: if the vector store falls back to a default key, the embeddings of your confidential data are protected by a key you do not control.
Give the service role decrypt on the key
The knowledge base service role (see the least-privilege KB role control) needs kms:Decrypt (and kms:GenerateDataKey) on this key, or ingestion and retrieval fail with access errors. Keep key administration in a separate role from key use.
Naming note: replace the Region in kms:ViaService and use a Region-local CMK. Use the same key consistently across sources, store, and sessions so nothing falls back to a default key.Acceptance criteria
Ingestion, vector store, sessions, and S3 sources are encrypted with a customer managed key; the KB service role has the required key policies; transit uses TLS 1.2+.
Practical implementation
How this control is implemented in each reference architecture:
A customer managed key in the Generative AI account encrypts the whole RAG chain — ingestion, the OpenSearch Serverless vector store, query sessions, and the S3 sources — with TLS in transit.
- Create a customer managed KMS key and set it on the Bedrock knowledge base ingestion job, the OpenSearch Serverless collection, and query sessions in the Generative AI account.
- Encrypt the S3 data-source buckets and any Secrets Manager secrets with the same key, and require TLS 1.2+ on all endpoints.
- Grant the KB service role only the key-policy permissions it needs, and keep key administration with the platform team.
How to validate: Ingestion, vector store, sessions, and S3 sources all show the customer managed key; the KB role has just the needed key permissions; transit is TLS 1.2+.
Avoid: Encrypting the source bucket but leaving the vector store on a default key. Embeddings can reconstruct source content, so encrypt the vector store with your own key too.
One customer managed key in the account encrypts ingestion, the vector store, sessions, and S3 sources, with the KB role scoped to just the key permissions it needs.
- Create a dedicated customer managed KMS key and set it on the knowledge base ingestion job, the OpenSearch Serverless collection, and query sessions.
- Encrypt the S3 source buckets and Secrets Manager secrets with the same key and enforce TLS 1.2+.
- Scope the KB role's key permissions and keep key administration separate from runtime roles.
How to validate: Ingestion, vector store, sessions, and sources use the customer managed key; the KB role has minimal key permissions; transit is TLS 1.2+.
Avoid: Using default keys because the store is 'internal'. Encrypt the vector store and sources with a customer managed key you can scope and audit.
Threats addressed
- RAG data sources or embeddings readable if default keys or storage are compromised.
- Sensitive retrieved context exposed in transit.
AWS services
Pricing
The CMK carries a small monthly fee plus per-request KMS charges during ingestion and retrieval. These are minor next to embedding and vector-store costs; the value is end-to-end control and auditability of the key protecting your RAG data. See Encryption of knowledge base resources.
Framework mappings
OWASP GenAI/LLM Top 10 (2026)
- LLM02 Sensitive Information Disclosure
NIST AI Risk Management Framework (AI 100-1)
- MANAGE.1 AI risks are prioritized, responded to and managed
AWS Security Hub — AI Security Best Practices
- Bedrock.1 Amazon Bedrock data sources should be encrypted with customer managed AWS KMS keys
AWS Well-Architected Generative AI Lens (Security)
- GENSEC01-BP03 Implement least privilege access to data stores
Learning resources
References
- AWS SRA for AI — Capability 3, Data protection
AI Security Maturity Model