Bedrock knowledge base - automate datasource synchronize

0

I want to synchronize data sources in Bedrock knowledge base at midnight every day. Is it possible to automate with code that is not done by humans? If possible, please let me know how

Every day, pdf is being added to S3, and I have to synchronize with that directory including the added pdf.

2 Antworten
0

Hello.

You can synchronize to a data source in code using the start_ingestion_job() API.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent/client/start_ingestion_job.html
https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-ds-manage.html#kb-ds-update

For example, I think you can synchronize by creating the following code in Lambda.

import boto3

client = boto3.client('bedrock-agent')
def lambda_handler(event, context):
    response = client.start_ingestion_job(
        knowledgeBaseId='knowledgeBaseId',
        dataSourceId='dataSourceId'
    )
profile picture
EXPERTE
beantwortet vor 2 Monaten
profile pictureAWS
EXPERTE
überprüft vor 2 Monaten
0

Hi,

You have then multiple ways to trigger the codef proposed by Riku as a Lambda function at midnight every day: for example, Eventbridge Scheduler at https://aws.amazon.com/eventbridge/scheduler/

This function will start the job but not monitor it.

If you want to monitor job execution (and retry it when needed), you may prefer AWS Batch scheduling where jobs can last more than the max 15 min of a Lambda. See https://docs.aws.amazon.com/batch/latest/userguide/job_scheduling.html

Best,

Didier

profile pictureAWS
EXPERTE
beantwortet vor 2 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen