Skip to content

DataSource

Source: src/AWS/Bedrock/DataSource.ts

A data source attached to an Amazon Bedrock KnowledgeBase — the origin of the documents the knowledge base embeds and indexes.

The most common source is an S3 bucket. After the data source is created, start an ingestion job (bedrock-agent:StartIngestionJob) to crawl the source, chunk + embed the documents, and write them to the vector store. Ingestion is not part of the desired-state lifecycle — trigger it whenever the underlying documents change.

import * as Bedrock from "alchemy/AWS/Bedrock";
const source = yield* Bedrock.DataSource("docs-bucket", {
knowledgeBaseId: kb.knowledgeBaseId,
dataSourceConfiguration: {
type: "S3",
s3Configuration: { bucketArn: bucket.bucketArn },
},
dataDeletionPolicy: "DELETE",
});