Dynamodb To Elasticsearch
DynamoDB scan operation very costly and not recommended at all. DynamoDB should query only suing the indexes. So The easiest way to configure a search domain to search DynamoDB data is to use the Amazon CloudSearch that is elastic search.
We can use the lambda function to index DynamoDB content to elastic search service.
Enable the dynamo DB streams for the table, by using the manage stream options like below screenshot
Create the necessary IAM role for the Lambda function so that it can access both the dynamo DB stream and the elastic search server. Example IAM police
Create an elastic search domain or use one of the existing. After that create the lambda function which will read the events from the DynamonDB streams and write to elastic search.
AWS will not assign a public IP to elastic search, so the lambda function must need to run from the same VPC as of the elastic search.
Sample Lambda code
Git hub project source code.https://github.com/kanhu/dynamodb-to-elasticsearch