aws / aws/aws-cdk

(aws-bedrock-alpha): add Knowledge Base and Data Source L2 constructs

Open
#36,592 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-bedrock-alpha effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

CDK provides the L1 constructs `CfnKnowledgeBase` and `CfnDataSource` for Bedrock, but there are currently no official L2 constructs in `@aws-cdk/aws-bedrock-alpha` to make it easy to:
- create a Bedrock Knowledge Base (especially vector KBs),
- provision or attach the required vector store/index backing it, and
- attach/configure Data Sources for ingestion.

There are existing L2 implementations in `awslabs/generative-ai-cdk-constructs` for Knowledge Bases / vector stores / data sources, but that project indicates Bedrock L2 constructs are transitioning to `@aws-cdk/aws-bedrock-alpha` and the awslabs L2s are deprecated. We’d like an official, CDK-core path for production deployments.

### Use Case

We deploy RAG solutions with Bedrock Knowledge Bases via CDK across multiple environments (dev/test/prod). We need type-safe, production-ready constructs that:

1. Simplify Knowledge Base creation
- Configure embeddings + KB settings without working around quirks from experimental gen AI CDK constructs
- Make it straightforward to supply an existing vector store/index OR be able to create a new vector store/index
2. Simplify vector store + index wiring
- Provide clear, well-typed configuration for common backends
- Avoid "gotchas" when connecting the KB to the vector store/index

3. Simplify Data Source attachment + ingestion configuration
- First-class constructs for S3 (at minimum) and other supported source types
- Typed ingestion helpers (chunking/parsing/transformation/context enrichment)

4. Improve stability and reduce boilerplate
- Provide secure-by-default IAM/grant helpers and integration with S3/KMS/VPC constructs
- Reduce the number of deployment quirks/workarounds compared to using `awslabs/generative-ai-cdk-constructs`

### Proposed Solution

Add official L2 constructs to `@aws-cdk/aws-bedrock-alpha` for Knowledge Bases and Data Sources, modeled after other AWS CDK L2 libraries and informed by the existing awslabs implementation. For example:

- `VectorKnowledgeBase` L2
- optionally creates a default vector store + index (or accepts existing)
- exposes properties like `knowledgeBaseId`, `knowledgeBaseArn`
- provides grant helpers (e.g., retrieve / retrieve-and-generate style permissions)

- `DataSource` L2 + concrete implementations (starting with `S3DataSource`)
- easy attachment to a Knowledge Base
- typed ingestion configuration (chunking/parsing/transformation/context enrichment)

- Import helpers (e.g., `fromKnowledgeBaseAttributes`, `fromDataSourceAttributes`)

Example (TypeScript, rough shape):

```ts
const kb = new bedrock.VectorKnowledgeBase(this, 'Kb', {
// embeddings model, vector store backend, optional index creation
});

new bedrock.S3DataSource(this, 'Docs', {
knowledgeBase: kb,
bucket: docBucket,
// ingestion config (chunking/parsing/etc.)
});

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### AWS CDK Library version (aws-cdk-lib)

2.x

### AWS CDK CLI version

2.x

### Environment details (OS name and version, etc.)

all

Contributor guide

Open the contributing guide

Research direction

Start in the @aws-cdk/aws-bedrock-alpha package by reviewing the existing CfnKnowledgeBase and CfnDataSource L1 constructs, then compare the deprecated implementations in awslabs/generative-ai-cdk-constructs. The work is done when official Knowledge Base and Data Source L2 constructs cover the proposed vector-store, S3 ingestion, import, and grant-helper scenarios with stable typed configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.