In this tutorial, you learn how to use Amazon Kendra create a new index and query the index for results.
Amazon Kendra is a highly accurate and easy to use enterprise search service that’s powered by machine learning. Amazon Kendra delivers powerful search capabilities to your websites and applications, so your end users can quickly find the information they need within the vast amount of content spread across your company.
Amazon Kendra lets you ask natural language questions in addition to simple keywords and get the answers you’re looking for, whether that is a precise answer, an FAQ response, or an entire document. Amazon Kendra also lets you easily add content from Amazon S3, Amazon RDS, Microsoft SharePoint Online, ServiceNow, and Salesforce into a centralized location.
In this tutorial, you learn how to:
- Set up a new index in Amazon Kendra
- Set up an Amazon S3 bucket as a data source and ingest data using an Amazon Kendra connector
- Set up an FAQ data source
- Query the index using the Console search
For this tutorial, you use Amazon.com help documents in HTML format as discovered by the Amazon Kendra data source connector.
|About this Tutorial|
|Cost||Less than $1
|Use Case||Machine Learning|
|Last Updated||September 11, 2020|
Complete the following steps to set up the Amazon Kendra index. An index can contain documents that are indexed from a data source, documents that are added directly to the index, and FAQs. Once the index is active you can index your documents using the operation or using one of the supported data sources.
Note: For more information, see Creating an index in the Amazon Kendra documentation.
a. Sign in to the Amazon Kendra console, and in the top right corner, verify your AWS Region is set to N. Virginia. Then, choose Create an index.
b. On the Index details page, fill the following fields and choose Next.
- Index name: hands-on-tutorial
- Description: Amazon Kendra tutorial.
- IAM role: Create a new role
- Role name: AmazonKendra-us-east-1-hands-on-tutorial
When you create an index, data source, or an FAQ, Amazon Kendra needs access to the AWS resources required to create the Amazon Kendra resource. While the index is being created, you can update the IAM role to allow it to read from Amazon S3. In a production environment, this step is where you can lock down access to only read specific buckets or files/objects.
Complete the following steps to update the IAM role to allow Amazon S3 access.
Note: For more information, see IAM access roles for Amazon Kendra in the Amazon Kendra documentation.
A data source is a location, such as an Amazon Simple Storage Service (Amazon S3) bucket, where you store the documents for indexing. Data sources can be automatically synchronized with an Amazon Kendra index so that new, updated, or deleted documents in the source repositories are included in searches. Connectors maintain document access rights and can be scheduled to automatically sync your index with your data source, so you're always securely searching through the most up to date content.
Complete the following steps to add a connector to the Amazon S3 bucket containing the Amazon.com help documents sample as a data source.
Note: For more information, see Data sources in the Amazon Kendra documentation.
For this step, you upload an FAQ to provide Kendra with direct answers to commonly asked questions. Amazon Kendra finds the closest question to the search query and returns the corresponding answer.
Complete the following steps to add an FAQ using the sample amazon-help-faqs.
Note: For more information, see Amazon Kendra Features.
- FAQ name: amazon-help-faqs
- S3: s3://serverless-analytics/amazon-help/faqs/kendrapost.csv
- IAM role: AmazonKendra-us-east-1-hands-on-tutorial
You should see the new FAQ and a message, You successfully created the following FAQ:’amazon-help-faqs’.
Now you can use the text search console to query your newly created index. This is just one of many ways you can query your index. When you search your index, Amazon Kendra uses all of the information that you provided to return the most accurate answer and relevant documents to your search query.
Complete the following steps to query your newly created index.
Note: For more information, see Searching indexes in the Amazon Kendra documentation.
In this step, you terminate the resources you used in this lab.
Important: Terminating resources that are not actively being used reduces costs and is a best practice. Not terminating your resources will result in charges to your account.
Delete the index:
- Open the Amazon Kendra Console.
- In the left navigation pane, choose Indexes.
- Choose the hands-on-tutorial index and then choose Actions, Delete.
- Type Delete to confirm.
Delete the IAM role and policy:
- Open the IAM Console.
- In the left navigation pane, choose Roles.
- In the search box, type hands-on-tutorial.
- Select the AmazonKendra-us-east-1-hands-on-tutorial role and then choose Delete role.
- Choose Yes, delete
- In the left navigation pane, choose Policies.
- In the search box, type hands-on-tutorial.
- Select the AmazonKendra-us-east-1-hands-on-tutorial policy and then choose Policy actions, Delete.
- Choose Delete.
You created and queried an index with Amazon Kendra.
Recommended next steps
Learn more about Amazon Kendra by reading the Amazon Kendra Developer Guide.
Read more about Amazon Kendra features
See the Amazon Kendra Features page for more information.