Pattern
apigw-http-api-lambda-bedrock-dynamodb-vector-search-cdk
A TypeScript AWS CDK pattern that creates a serverless semantic-search API with Amazon API Gateway HTTP API, AWS Lambda, Amazon Bedrock embeddings, and a native Amazon DynamoDB vector index.
Why this pattern is useful
This pattern gives developers a reusable starting point for semantic search while keeping vectors and operational data together in DynamoDB. It avoids a separate vector database and record-synchronization pipeline, uses a tenant-scoped composite primary key so document IDs cannot collide across tenants, demonstrates tenant-scoped searches with optional category filtering, and provides an idempotent custom resource for the DynamoDB vector-index lifecycle while native CDK and CloudFormation coverage is unavailable.
The focused integration can be adapted for document discovery, product catalogs, support search, multi-tenant SaaS, and knowledge-search APIs. The collection currently has an S3 Vectors RAG example but no native DynamoDB vector-search pattern implemented with AWS CDK and TypeScript.
Scope
- AWS services: Amazon API Gateway, AWS Lambda, Amazon Bedrock, and Amazon DynamoDB
- Infrastructure as code: AWS CDK
- Language: TypeScript
- Custom code: One application Lambda handler and the bounded custom-resource provider required to manage the vector index
- Pattern type: Focused IaC integration, not a complete application, utility, or demo repository
- PR scope: One pattern directory only
Model compliance
example-pattern.json contains the complete 354-word introduction.
- It contains 4 AWS documentation and blog resources.
- The author entry contains a one-sentence bio plus LinkedIn and Twitter IDs.
- The README includes Requirements, Architecture, Flow, Resources, How it works, Deployment Instructions, Testing, and Cleanup.
- The architecture diagram uses official AWS Architecture Icons.
Validation
- A clean Node.js 24 dependency installation, TypeScript build, all 9 tests across 3 suites, CDK synthesis, and repository metadata schema validation passed.
- The exact submitted commit,
cf375c1, was deployed by following the README from a clean application-stack state and reached CREATE_COMPLETE.
- Both documented interfaces passed: API Gateway HTTP requests and direct Lambda invocations. Live testing also covered tenant isolation, category filtering, malformed JSON, oversized embedding input, oversized multibyte tenant keys, and an unknown route.
- Application, custom-resource provider, and framework logs contained no unexpected errors.
- The documented cleanup reached
DELETE_COMPLETE; follow-up checks found no residual application stack, DynamoDB tables, Lambda functions, HTTP APIs, IAM roles, or application log groups.
- No credentials, account identifiers, API endpoints, profiles, role ARNs, or generated deployment files are included in the PR.
GitHub PR for template
#3275
Pattern
apigw-http-api-lambda-bedrock-dynamodb-vector-search-cdkA TypeScript AWS CDK pattern that creates a serverless semantic-search API with Amazon API Gateway HTTP API, AWS Lambda, Amazon Bedrock embeddings, and a native Amazon DynamoDB vector index.
Why this pattern is useful
This pattern gives developers a reusable starting point for semantic search while keeping vectors and operational data together in DynamoDB. It avoids a separate vector database and record-synchronization pipeline, uses a tenant-scoped composite primary key so document IDs cannot collide across tenants, demonstrates tenant-scoped searches with optional category filtering, and provides an idempotent custom resource for the DynamoDB vector-index lifecycle while native CDK and CloudFormation coverage is unavailable.
The focused integration can be adapted for document discovery, product catalogs, support search, multi-tenant SaaS, and knowledge-search APIs. The collection currently has an S3 Vectors RAG example but no native DynamoDB vector-search pattern implemented with AWS CDK and TypeScript.
Scope
Model compliance
example-pattern.jsoncontains the complete 354-word introduction.Validation
cf375c1, was deployed by following the README from a clean application-stack state and reachedCREATE_COMPLETE.DELETE_COMPLETE; follow-up checks found no residual application stack, DynamoDB tables, Lambda functions, HTTP APIs, IAM roles, or application log groups.GitHub PR for template
#3275