Skip to content

DataSource

Source: src/AWS/QBusiness/DataSource.ts

An Amazon Q Business data source — a connector that syncs documents from a repository (S3 bucket, website, SharePoint, …) into an index.

S3 Data Source

import * as AWS from "alchemy/AWS";
const source = yield* AWS.QBusiness.DataSource("Docs", {
applicationId: app.applicationId,
indexId: index.indexId,
roleArn: dataSourceRole.roleArn,
configuration: {
type: "S3",
syncMode: "FORCED_FULL_CRAWL",
connectionConfiguration: {
repositoryEndpointMetadata: { BucketName: bucket.bucketName },
},
repositoryConfigurations: {
document: {
fieldMappings: [{
indexFieldName: "s3_document_id",
indexFieldType: "STRING",
dataSourceFieldName: "s3_document_id",
}],
},
},
},
});

Scheduled Sync

const source = yield* AWS.QBusiness.DataSource("Docs", {
applicationId: app.applicationId,
indexId: index.indexId,
roleArn: dataSourceRole.roleArn,
syncSchedule: "cron(0 12 * * ? *)",
configuration: { ... },
});