Skip to content

aws-samples/amazon-kendra-faq-refresher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Amazon Kendra FAQ Refresher

Amazon Kendra is an intelligent search service powered by machine learning (ML). Kendra reimagines enterprise search for your websites and applications so your employees and customers can easily find the content they’re looking for, even when it’s scattered across multiple locations and content repositories within your organization.

This solution hosts an AWS Lambda Function which is configured to get triggered by an Amazon S3 Event Notification. When you upload a FAQ to the Amazon S3 folder mapped to a specific Amazon Kendra Index, it creates a new version of the FAQ for your Index. Older versions of FAQs are deleted only after the new FAQ Index Version is created, achieving zero downtime of Index searching.

Architecture


Prerequisite

  • AWS Account

  • AWS SAM CLI(if using SAM CLI to deploy stack, else Skip this step)

  • Configuring the AWS CLI

    • Set up your AWS following the Guide

Deployment Steps

We provide 2 sets of deployment instructions depending on the method of deployment. Choose either Deployment Steps using CloudFormation Stack or Deployment Steps using SAM Template.

Deployment Steps using CloudFormation Stack

The template that deploys the solution can be found at template.yaml.

If you're using the AWS Console, follow the instructions at AWS CloudFormation documentation: Creating a stack on the AWS CloudFormation console.

If you're using the AWS CLI, follow the instructions at AWS CloudFormation documentation: Using the AWS Command Line Interface. For a sample command, run the following, replacing the parameters accordingly. You can also override additional parameters.

aws cloudformation deploy \
  --template-file ./template.yaml \
  --stack-name kendra-faq-refresher \
  --parameter-overrides   EmailAddress=<REPLACE_WITH_EMAIL_ADDRESS> --capabilities CAPABILITY_NAMED_IAM --region <YOUR_TARGET_REGION>
# Example below
aws cloudformation deploy \
  --template-file ./template.yaml \
  --stack-name kendra-faq-refresher \
  --parameter-overrides EmailAddress=example1@example.com --capabilities CAPABILITY_NAMED_IAM --region us-east-1

Deployment Steps using SAM Template

The template that deploys the solution can be found at template.yaml.

  • clone repository git clone <repo-url>
  • on your terminal
    • cd amazon-kendra-faq-refresher/sam-app
    • sam build
    • sam deploy --guided
Setting default arguments for 'sam deploy'
	=========================================
	Stack Name [sam-app]: kendra-faq-refresher
	AWS Region [us-east-1]: us-east-1
	Parameter BucketNamePrefix [kendra-faq]: kendra-faq
	Parameter EmailAddress []: foobar@foobar.co.uk
	#Shows you resources changes to be deployed and require a 'Y' to initiate deploy
	Confirm changes before deploy [y/N]: N
	#SAM needs permission to be able to create roles to connect to the resources in your template
	Allow SAM CLI IAM role creation [Y/n]: y
	#Preserves the state of previously provisioned resources when an operation fails
	Disable rollback [y/N]: N
	Save arguments to configuration file [Y/n]: n

Sample Amazon Kendra FAQ

Three sample Amazon Kendra FAQ files of format json, csv and csv faq with header are being stored here


Testing the solution

Follow the instructions at the blog page to test the solution.

Cleanup Steps

Cleanup Steps using CloudFormation

  • Delete the CloudFormation stack. For instructions, refer to Deleting a stack on the AWS CloudFormation console.

  • If you are using AWS CLI, you can use aws cloudformation delete-stack --stack-name kendra-faq-refresher --region <YOUR_TARGET_REGION>

    • example : aws cloudformation delete-stack --stack-name kendra-faq-refresher --region us-east-1

Cleanup Steps using SAM

  • Empty the S3 bucket that was created by the CloudFormation stack and used to contain the FAQ documents. For instructions, refer to AWS S3 documentation: Emptying a bucket.

  • sam delete --stack-name kendra-faq-refresher --region us-east-1