In this tutorial, you learn how to use HAQM Kendra create a new index and query the index for results.
HAQM Kendra is a highly accurate and easy to use enterprise search service that’s powered by machine learning. HAQM 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.
HAQM 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. HAQM Kendra also lets you easily add content from HAQM S3, HAQM RDS, Microsoft SharePoint Online, ServiceNow, and Salesforce into a centralized location.
In this tutorial, you learn how to:
- Set up a new index in HAQM Kendra
- Set up an HAQM S3 bucket as a data source and ingest data using an HAQM Kendra connector
- Set up an FAQ data source
- Query the index using the Console search
For this tutorial, you use HAQM.com help documents in HTML format as discovered by the HAQM Kendra data source connector.
About this Tutorial | |
---|---|
Time | 1 hour |
Cost | Less than $1 |
Use Case | Machine Learning |
Products | HAQM Kendra |
Audience | Developer |
Level | Beginner |
Last Updated | September 11, 2020 |
Step 1. Create an AWS Account
The cost of this tutorial is less than $1.
Already have an account? Sign-in
Step 2. Set up the HAQM Kendra index
Complete the following steps to set up the HAQM 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 HAQM Kendra documentation.
a. Sign in to the HAQM 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: HAQM Kendra tutorial.
- IAM role: Create a new role
- Role name: HAQMKendra-us-east-1-hands-on-tutorial


Step 3. Update the IAM role
When you create an index, data source, or an FAQ, HAQM Kendra needs access to the AWS resources required to create the HAQM Kendra resource. While the index is being created, you can update the IAM role to allow it to read from HAQM 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 HAQM S3 access.
Note: For more information, see IAM access roles for HAQM Kendra in the HAQM Kendra documentation.





Step 4. Configure an S3 connector to the data source
A data source is a location, such as an HAQM Simple Storage Service (HAQM S3) bucket, where you store the documents for indexing. Data sources can be automatically synchronized with an HAQM 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 HAQM S3 bucket containing the HAQM.com help documents sample as a data source.
Note: For more information, see Data sources in the HAQM Kendra documentation.









Step 5. Add an FAQ
For this step, you upload an FAQ to provide Kendra with direct answers to commonly asked questions. HAQM 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 HAQM Kendra Features.

- FAQ name: amazon-help-faqs
- S3: s3://serverless-analytics/amazon-help/faqs/kendrapost.csv
- IAM role: HAQMKendra-us-east-1-hands-on-tutorial

You should see the new FAQ and a message, You successfully created the following FAQ:’amazon-help-faqs’.

Step 6. Query the index
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, HAQM 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 HAQM Kendra documentation.



Step 7. Clean up
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 HAQM 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 HAQMKendra-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 HAQMKendra-us-east-1-hands-on-tutorial policy and then choose Policy actions, Delete.
- Choose Delete.
Congratulations
You created and queried an index with HAQM Kendra.
Recommended next steps
Learn more
Learn more about HAQM Kendra by reading the HAQM Kendra Developer Guide.
Read more about HAQM Kendra features
See the HAQM Kendra Features page for more information.