The instruction below outline how to keep OpenSearch upto date with a DynamoDB table via. a Lambda function
- Run the CloudFormation stack below
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
-
Update the code section of the deployed lambda with the lambda.py code
-
Update the
<os_url>
place holder in the lambda code -
Add a DynamoDB trigger to the lambda
-
Use the PartiQL editor in DynamoDB insert 3 record
-- Insert #1
INSERT INTO "workshop-table" VALUE {
'person-id': 1,
'name': 'Will Smith',
'email': '[email protected]'
}
-- Insert #2
INSERT INTO "workshop-table" VALUE {
'person-id': 2,
'name': 'John Parker',
'email': '[email protected]'
}
-- Insert #3
INSERT INTO "workshop-table" VALUE {
'person-id': 3,
'name': 'Adam William',
'email': '[email protected]'
}
-
Log into the OpenSearch dashboard, create and index patter you can see the 3 records in OpenSearch
-
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