https://github.com/ev2900/opensearch_dynamodb_example
Update OpenSearch to miror changes that happen in Dynamo DB via. a Lambda Function
https://github.com/ev2900/opensearch_dynamodb_example
aws dynamodb lambda opensearch
Last synced: 7 months ago
JSON representation
Update OpenSearch to miror changes that happen in Dynamo DB via. a Lambda Function
- Host: GitHub
- URL: https://github.com/ev2900/opensearch_dynamodb_example
- Owner: ev2900
- Created: 2022-08-04T18:21:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-10T16:44:49.000Z (7 months ago)
- Last Synced: 2025-06-10T17:54:55.164Z (7 months ago)
- Topics: aws, dynamodb, lambda, opensearch
- Language: Python
- Homepage:
- Size: 446 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DynamoDB OpenSearch Example

The instruction below outline how to keep OpenSearch upto date with a DynamoDB table via. a Lambda function
1. Run the CloudFormation stack below
[](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=dynamo-lambda-opensearch&templateURL=https://sharkech-public.s3.amazonaws.com/misc-public/dynamo_lambda_opensearch.yaml)
The resources created by the CloudFormation stack are documented in the architecture below

Or run the CloudFormation stack below to deploy a VPC based architecture
[](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=dynamo-lambda-opensearch&templateURL=https://sharkech-public.s3.amazonaws.com/misc-public/dynamo_lambda_opensearch_vpc.yaml)

2. Update the code section of the deployed lambda with the [lambda.py](https://github.com/ev2900/DynamoDB_OpenSearch_Example/blob/main/lambda.py) code
3. Update the ``````place holder in the lambda code
4. Add a DynamoDB trigger to the lambda
5. Use the PartiQL editor in DynamoDB insert 3 record
```
-- Insert #1
INSERT INTO "workshop-table" VALUE {
'person-id': 1,
'name': 'Will Smith',
'email': 'willsmith@email.com'
}
-- Insert #2
INSERT INTO "workshop-table" VALUE {
'person-id': 2,
'name': 'John Parker',
'email': 'parker@email.com'
}
-- Insert #3
INSERT INTO "workshop-table" VALUE {
'person-id': 3,
'name': 'Adam William',
'email': 'adamw@email.com'
}
```
6. Log into the OpenSearch dashboard, create and index patter you can see the 3 records in OpenSearch
7. Optional. Test the update / delete capabilities via. the PartiQL editor
Update(s)
```
-- Update #1
UPDATE "workshop-table" SET name='William Smith' WHERE "person-id" = 1
-- Update #2
UPDATE "workshop-table" SET name='Jonathan Parker' WHERE "person-id" = 2
-- Update #3
UPDATE "workshop-table" SET name='Sr. Adam William' WHERE "person-id" = 3
```
Delete(s)
```
-- Delete #1
DELETE FROM "workshop-table" WHERE "person-id" = 1
-- Delete #2
DELETE FROM "workshop-table" WHERE "person-id" = 2
-- Delete #3
DELETE FROM "workshop-table" WHERE "person-id" = 3
```