aws-samples / aws-samples/serverless-patterns

New pattern submission - apigw-http-api-lambda-bedrock-dynamodb-vector-search-cdk

Open
#3,276 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.8k
Forks
1.1k
Avg merge
7d 14h
Merged PRs (30d)
6

Description

## 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`](https://github.com/proton0210/serverless-patterns/blob/proton0210-feature-dynamodb-vector-search-cdk/apigw-http-api-lambda-bedrock-dynamodb-vector-search-cdk/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`](https://github.com/proton0210/serverless-patterns/commit/cf375c1adc3f2a81e9a330163604bdf5bbc92602), 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

https://github.com/aws-samples/serverless-patterns/pull/3275

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the pattern directory named apigw-http-api-lambda-bedrock-dynamodb-vector-search-cdk and the linked template PR #3275, then compare its example-pattern.json and README with the repository’s pattern conventions. Run the stated TypeScript build, test suites, CDK synthesis, and metadata validation; done means the pattern meets those checks and its documented deployment and cleanup complete successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api, cloud, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.