Amazon S3 Vectors with AWS Lambda and Amazon Bedrock RAG

Amazon S3 Vectors → AWS Lambda → Amazon Bedrock

Build a serverless RAG pipeline using Amazon S3 Vectors for cost-optimized vector storage, Lambda for orchestration, and Amazon Bedrock for embeddings and generation.

This pattern deploys two Lambda functions backed by Amazon S3 Vectors and Amazon Bedrock to implement a serverless Retrieval-Augmented Generation (RAG) pipeline.
The Ingest function takes text documents, generates vector embeddings using Bedrock Titan Embeddings V2, and stores them in an S3 vector index with metadata. The Query function takes a natural language question, embeds it, performs a similarity search against S3 Vectors, and uses Bedrock Claude to generate an answer grounded in the retrieved context.
S3 Vectors provides purpose-built, cost-optimized vector storage with sub-second query latency — no vector database infrastructure to manage.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/s3-vectors-lambda-bedrock-cdk

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk destroy.

Created by:

Nithin Chandran R

Nithin Chandran R

Technical Account Manager at AWS

Follow on LinkedIn