AWS Lambda from Amazon Kendra to Amazon Bedrock

Amazon Kendra → AWS Lambda → Amazon Bedrock

AWS Lambda function to retrieve documents from an Amazon Kendra index and pass it to Amazon Bedrock for a generated response.

AWS Lambda: Two AWS Lambda functions are created. DataSourceSync Lambda function crawls and indexes the content. InvokeBedrockLambda AWS Lambda function that invokes the specified model by passing the retrieved content from Amazon Kendra as context to the generative AI model.
Amazon Kendra: An Amazon Kendra index is created with a S3 data source. When a the InvokeBedrockLambda function is called, documents are retrieved from the Amazon Kendra index.
Amazon Bedrock: Documents retrieved from the Amazon Kendra index are sent to Amazon Bedrock which responds with a generated response.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/kendra-bedrock-cdk-python

Deploy

cdk deploy BedrockKendraStack --parameters S3DSBucketName=${YourS3BucketName}


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk destroy.

Created by:

Kruthi Jayasimha Rao

Kruthi Jayasimha Rao

Kruthi is a Partner Solutions Architect with a focus in Generative AI. She provides technical guidance to AWS Partners in following best practices to build secure, resilient, and highly available solutions in the AWS Cloud.

Follow on LinkedIn