Skip to content

New serverless pattern - s3-vectors-lambda-bedrock-cdk#3055

Open
NithinChandranR-AWS wants to merge 3 commits intoaws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-s3-vectors-lambda-bedrock-cdk
Open

New serverless pattern - s3-vectors-lambda-bedrock-cdk#3055
NithinChandranR-AWS wants to merge 3 commits intoaws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-s3-vectors-lambda-bedrock-cdk

Conversation

@NithinChandranR-AWS
Copy link
Copy Markdown

New Serverless Pattern: S3 Vectors with Lambda and Amazon Bedrock RAG

Description

Deploys a serverless RAG (Retrieval-Augmented Generation) pipeline using Amazon S3 Vectors for cost-optimized vector storage, Lambda for orchestration, and Amazon Bedrock for embeddings (Titan V2) and generation (Claude).

Architecture

Ingest Lambda → Bedrock Titan Embeddings V2 → S3 Vector Index (1024-dim, cosine)
Query Lambda → Bedrock Titan Embeddings V2 → S3 Vectors (similarity search) → Bedrock Claude → Answer

Key Features

  • Two Lambda functions: Ingest (embed + store) and Query (search + generate)
  • Custom resource auto-creates S3 vector bucket + index on deploy
  • 1024-dimensional Titan Embeddings V2 with cosine similarity
  • No vector database infrastructure to manage

Framework / Language

  • AWS CDK (TypeScript)
  • Lambda runtime: Node.js 20.x

Testing

  • Includes ingest and query CLI commands with sample data
  • CDK synth verified (16 CloudFormation resources)

- Fix Bedrock model ID default (add -v1:0 suffix for inference profile)
- Rename VectorBucketName output to avoid CfnParameter name collision

Tested: CDK synth verified, deployed to AWS account
- Scope bedrock:InvokeModel to Titan Embeddings and Claude inference
  profile ARNs instead of wildcard
- Add s3vectors:DeleteVectorBucket and s3vectors:DeleteVectorIndex to
  prevent stack rollback getting stuck in DELETE_FAILED
- Note: s3vectors does not support resource-level ARNs yet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants