Amazon Lex chatbot with Amazon Kendra on AWS
Partner Solution Deployment Guide
Sanchit Jain, Example Company Name, Ltd.
Shivansh Singh, AWS Integration & Automation team
|Refer to the GitHub repository to view source files, report bugs, submit feature ideas, and post feedback about this Partner Solution. To comment on the documentation, refer to Feedback.
This Partner Solution was created by Example Company Name, Ltd. in collaboration with Amazon Web Services (AWS). Partner Solutions are automated reference deployments that help people deploy popular technologies on AWS according to AWS best practices. If you’re unfamiliar with AWS Partner Solutions, refer to the AWS Partner Solution General Information Guide.
This guide covers the information you need to deploy the Amazon Lex chatbot with Amazon Kendra Partner Solution in the AWS Cloud.
This Amazon Web Services (AWS) Partner Solution deploys an Amazon Kendra index along with a data source that uses an Amazon Simple Storage Service (Amazon S3) bucket as the document repository, and then integrates them with an Amazon Lex chatbot. Organizations can use this Partner Solution to enhance the search and fulfillment capabilities of their Amazon Lex chatbot by letting users query the enterprise data repository using Amazon Kendra.
This Partner Solution lets third-party products integrate with Amazon Lex and Amazon Kendra to provide answers to user questions that originate from a document search interface.
This Partner Solution creates an Amazon Lex chatbot with an Amazon Kendra index. The index is linked to an Amazon S3 bucket data repository, which contains a sample FAQ document for testing. The Amazon Lex chatbot is connected to the Amazon Kendra index via the Amazon Kendra search intent.
Costs and licenses
There is no cost to use this Partner Solution, but you will be billed for any AWS services or resources that this Partner Solution deploys. For more information, refer to the AWS Partner Solution General Information Guide.
Deploying this Partner Solution with default parameters builds the following Quantiphi environment in the AWS Cloud.
As shown in Figure 1, this Partner Solution sets up the following:
An Amazon Lex chatbot with associated intents for sending search queries to Amazon Kendra.
An Amazon Kendra index for providing search results.
An Amazon S3 bucket used as the data source.
An AWS Lambda function used to query the Amazon Kendra index and return the appropriate response.
AWS Identity and Access Management (IAM) roles for the Amazon Lex chatbot, and a Lambda function with the necessary permissions to access AWS services and resources.
This Partner Solution provides single deployment option:
Deploy Quantiphi on AWS. This option builds a new AWS environment consisting of the Amazon Lex chatbot, AWS Lambda functions, an Amazon Kendra index, an Amazon S3 data source, a sample FAQ file, and other infrastructure components.
Prepare for the deployment
Before launching the CloudFormation templates and deploying the Quick Start, be sure that you have an Amazon S3 bucket in place. This S3 bucket should contain the documents that you want to be indexed by Amazon Kendra to provide answers to user questions. This S3 bucket is your document repository for the Lex chatbot, and is used as a data source by Amazon Kendra. You can bring your own S3 bucket or use Quantiphi’s S3 bucket (s3://quickstart-quantiphi-lex-kendra/) with sample documents as an example.
Sign in to your AWS account, and launch this Partner Solution, as described under Deployment options. The AWS CloudFormation console opens with a prepopulated template.
Choose the correct AWS Region, and then choose Next.
On the Create stack page, keep the default setting for the template URL, and then choose Next.
On the Specify stack details page, change the stack name if needed. Review the parameters for the template. Provide values for the parameters that require input. For all other parameters, review the default settings and customize them as necessary. When you finish reviewing and customizing the parameters, choose Next.
Unless you’re customizing the Partner Solution templates or are instructed otherwise in this guide’s Predeployment section, don’t change the default settings for the following parameters:
QSS3KeyPrefix. Changing the values of these parameters will modify code references that point to the Amazon Simple Storage Service (Amazon S3) bucket name and key prefix. For more information, refer to the AWS Partner Solutions Contributor’s Guide.
On the Review page, review and confirm the template settings. Under Capabilities, select all of the check boxes to acknowledge that the template creates AWS Identity and Access Management (IAM) resources that might require the ability to automatically expand macros.
Choose Create stack. The stack takes about 25 minutes to deploy.
Monitor the stack’s status, and when the status is CREATE_COMPLETE, the Amazon Lex chatbot with Amazon Kendra deployment is ready.
To view the created resources, choose the Outputs tab.
Test the deployment
To test the deployment using Quantiphi’s S3 bucket with the sample documents, perform these steps:
Go to the Amazon Lex console, find the bot named self_service_lex_bot, and choose Test Chatbot to start the conversation.
Test the Amazon Lex chatbot intents by typing ‘Hi’. You should receive the following response: ‘Amazon Lex: Hello! I am the COVID-19 Rapid Response Bot! You can ask me questions related to COVID-19. As a disclaimer, I’m not responsible for providing professional medical advice, diagnosis or treatment. If you are experiencing life threatening emergency, please call 911. How can I help?’
Test the Amazon Kendra search capabilities and connection with Amazon Lex by typing ‘What preventive measures can I take?’. You should receive the following response: On searching the Enterprise repository, I have found the following answer in the FAQs. Wash your hands often, avoid close contact with people and cover your mouth and nose with a cloth face cover when around people, monitor your health, clean and disinfect frequently touched surfaces daily.’
Other useful information
You can use a custom user interface or third-party product as a front end for users to interact with and submit questions. As a back end, use the Amazon Lex chatbot that is deployed with this Quick Start to connect with Amazon Kendra to answer user questions.
After you deploy a Partner Solution, confirm that your resources and services are updated and configured—including any required patches—to meet your security and other needs. For more information, refer to the Shared Responsibility Model.
To submit feature ideas and report bugs, use the Issues section of the GitHub repository for this Partner Solution. To submit code, refer to the Partner Solution Contributor’s Guide. To submit feedback on this deployment guide, use the following GitHub links:
This document is provided for informational purposes only. It represents current AWS product offerings and practices as of the date of issue of this document, which are subject to change without notice. Customers are responsible for making their own independent assessment of the information in this document and any use of AWS products or services, each of which is provided "as is" without warranty of any kind, whether expressed or implied. This document does not create any warranties, representations, contractual commitments, conditions, or assurances from AWS, its affiliates, suppliers, or licensors. The responsibilities and liabilities of AWS to its customers are controlled by AWS agreements, and this document is not part of, nor does it modify, any agreement between AWS and its customers.
The software included with this paper is licensed under the Apache License, version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at https://aws.amazon.com/apache2.0/ or in the accompanying "license" file. This code is distributed on an "as is" basis, without warranties or conditions of any kind, either expressed or implied. Refer to the License for specific language governing permissions and limitations.