[ad_1]
Amazon Kendra is an clever search service powered by machine studying (ML). Amazon Kendra reimagines enterprise seek for your web sites and purposes so your staff and clients can simply discover the content material they’re in search of, even when it’s scattered throughout a number of areas and content material repositories inside your group.
Amazon Kendra FAQs enable customers to add incessantly requested questions with their corresponding solutions. This helps to persistently reply frequent queries amongst end-users. As of this writing, once you need to replace FAQs, it’s essential to delete the FAQ and create it once more. On this put up, we current a less complicated, sooner method for updating your Amazon Kendra FAQs (with versioning enabled). Our methodology eliminates the handbook steps of making and deleting FAQs once you replace their contents.
Overview of answer
We use a totally deployable AWS CloudFormation template to create an Amazon Simple Storage Service (Amazon S3) bucket, which turns into the supply to retailer your Amazon Kendra FAQs. Every index-based FAQ is maintained within the folder with a prefix regarding the Amazon Kendra index.
This answer makes use of an AWS Lambda operate that will get triggered by an Amazon S3 occasion notification. Whenever you add an FAQ to the S3 folder mapped to a selected Amazon Kendra index, it creates a brand new model of the FAQ in your index. Older variations of FAQs are deleted solely after the brand new FAQ index model is created, attaining near-zero downtime of index looking.
The next determine reveals the workflow of how our methodology creates and deletes a brand new model of an Amazon Kendra FAQ.
The workflow steps are as follows:
- The person uploads the Amazon Kendra FAQ doc to the S3 bucket mapped to the Amazon Kendra index.
- The Amazon S3
PutObject
occasion triggers the Lambda operate, which reads the occasion particulars. - The Lambda operate creates a brand new model of the FAQ for the goal index for every uploaded doc and deletes the older variations of the FAQ.
- The Lambda operate then publishes a message to Amazon Simple Notification Service (Amazon SNS), which sends an e mail to the person notifying them that the FAQ has been efficiently up to date.
Stipulations
Earlier than you start the walkthrough, you want an AWS account (in case you don’t have one, you may sign up for one). You additionally have to create the recordsdata containing the pattern FAQs:
- fundamental.csv – The next code is the pattern FAQ CSV template:
- demo.json – The next code is the pattern FAQ JSON template:
- header_demo.csv – The next code is the pattern FAQ CSV template with header:
Deploy the answer
The CloudFormation templates that create the sources utilized by this answer can discovered within the GitHub repository. Comply with the directions within the repository to deploy the answer. AWS CloudFormation creates the next sources in your account:
- An S3 bucket that would be the supply for the Amazon Kendra FAQ.
- An Amazon Kendra index.
- An AWS Identity and Access Management (IAM) function for the Amazon Kendra FAQ to learn (
GetObject
) from the S3 bucket. - A Lambda operate that’s configured to get triggered by an Amazon S3 occasion. The operate is created outdoors of an Amazon VPC.
Notice that useful resource creation can take roughly half-hour.
After you run the deployment, you’ll obtain an e mail prompting you to substantiate the subscription on the approver e mail deal with. Select Affirm subscription.
You’re redirected to a web page confirming your subscription.
Confirm that the Amazon Kendra index is listed on the Amazon Kendra console. On this put up, we named the Amazon Kendra index sample-kendra-index
.
Add a pattern FAQ doc to Amazon S3
Within the earlier step, you efficiently deployed the CloudFormation stack. We use the output of the stack within the following steps:
- On the Outputs tab of the CloudFormation stack, notice the values for
S3Bucket
(kendra-faq-<random-stack-id>
) andKendraIndex
. - On the Amazon S3 console, navigate to the S3 bucket created from the CloudFormation stack.
- Select Create folder and create a folder known as
faq-<index-id>
. For index-id, use the worth you famous for the CloudFormation parameterKendraIndex
. After the folder is created, this turns into the prefix for thesample-kendra-index
FAQ. - Add the
demo.json
FAQ doc to that folder.
Confirm that the index FAQ is created
To substantiate that the index FAQ is created, full the next steps:
- On the Amazon Kendra console, navigate to the index
sample_kendra_index
, which was created as a part of the deployment. - Navigate to the FAQs web page for this index to verify if an FAQ is listed.
The index has the naming conference <file-name>-faq-<Date-Time>
.
When the FAQ is efficiently created, you’ll obtain one other e mail informing you about it. Chances are you’ll add new variations of the FAQ after you might have obtained this e mail.
Notice that the automation identifies the file format that it should use whereas creating the FAQ by studying the uploaded file extension and as an exception case by the prefix of header_
for the CSV doc with a header. The goal Amazon Kendra index is recognized by the S3 bucket folder title, which has the index ID because the suffix; for instance, faq-1f01abb8-341c-4921-ad16-139ee517a845
.
Add further FAQ paperwork
Amazon Kendra FAQ helps three forms of file format: CSV
, CSV_WITH_HEADER
, and JSON
. Guarantee that once you add a CSV file with the header, the file title ought to have a prefix with header_
(that is solely when utilizing the CSV file format with a header in its contents). To add your FAQ paperwork, full the next steps:
- Add the
header_demo.csv
file to the identical folder. - Confirm that the FAQ is created on the Amazon Kendra console.
FAQ creation is case-sensitive to the file format of the FAQ doc that you simply add. For instance, in case you add demo.json
and demo.JSON
, each are handled as distinctive objects in Amazon S3. Due to this fact, this motion creates two FAQs, reminiscent of demo-json-faq-22-09-2022-20-09-11
and demo-JSON-faq-22-09-2022-20-09-11
.
Create a brand new model of the index FAQ
Now the answer is self-sufficient and in a position to work independently everytime you add a brand new model of the FAQ doc in Amazon S3.
To check this, add a brand new up to date model of your demo.json
FAQ doc to the faq-<index-id>
folder. Whenever you navigate to the FAQ for the index, there will probably be an FAQ named <file-name>-faq-<Date-Time>
.
This answer creates a brand new model of the FAQ for the brand new model of the FAQ doc that was uploaded in Amazon S3. When the FAQ is lively, it deletes the older model of the FAQ for a similar doc.
Create an FAQ with an outline
This answer additionally helps creating an FAQ with an outline when recordsdata are named in a selected method: <document_name>-desc-<your faq description>.fileformat[json|csv]
. For instance, demo-desc-hello world.json
. Add this FAQ doc to the faq-<index-id>
folder.
After you add the doc, the FAQ will probably be created and it’ll have the outline as talked about within the file title.
It is best to solely use -desc-
when it’s essential to add an outline to an FAQ. When you add a file with the identical document_name
prefix, it should delete the previous FAQ created from the document_name.fileformat
FAQ doc and create a brand new FAQ with the outline.
Clear up
To wash up, carry out the next actions:
- Empty the S3 bucket that was created by the CloudFormation stack to retailer the FAQ paperwork. For directions, confer with Emptying a bucket.
- Delete the CloudFormation stack. For directions, confer with Deleting a stack on the AWS CloudFormation console.
Conclusion
On this put up, we launched an automatic strategy to handle your Amazon Kendra FAQs. After implementing this answer, it’s best to be capable of create and delete FAQs simply by importing them to an S3 bucket. This manner, you save time by avoiding repetitive handbook modifications and troubleshooting inconsistent points which might be brought on by sudden operational incidents. You can too audit Amazon Kendra FAQs throughout your group with confidence.
Do you might have suggestions about this put up? Submit your feedback within the feedback part. You can too put up questions on the AWS re:Post discussion board.
In regards to the Creator
Debojit is a DevOps guide who makes a speciality of serving to clients ship safe and dependable options utilizing AWS providers. He concentrates on infrastructure growth and constructing serverless options with AWS and DevOps. Other than work, Debojit enjoys watching motion pictures and spending time together with his household.
Glenn is a Cloud Architect at AWS. He makes use of know-how to assist clients ship on their desired outcomes of their cloud adoption journey. His present focus is DevOps and creating open-source software program.
Support authors and subscribe to content
This is premium stuff. Subscribe to read the entire article.