Skip to content

Update OpenSearch to miror changes that happen in Dynamo DB via. a Lambda Function

Notifications You must be signed in to change notification settings

ev2900/OpenSearch_DynamoDB_Example

Repository files navigation

DynamoDB OpenSearch Example

map-user map-user map-user

The instruction below outline how to keep OpenSearch upto date with a DynamoDB table via. a Lambda function

  1. Run the CloudFormation stack below

Launch CloudFormation Stack

The resources created by the CloudFormation stack are documented in the architecture below

dynamo-lambda-os

Or run the CloudFormation stack below to deploy a VPC based architecture

Launch CloudFormation Stack

dynamo-lambda-os

  1. Update the code section of the deployed lambda with the lambda.py code

  2. Update the <os_url>place holder in the lambda code

  3. Add a DynamoDB trigger to the lambda

  4. 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]'
}
  1. Log into the OpenSearch dashboard, create and index patter you can see the 3 records in OpenSearch

  2. 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

About

Update OpenSearch to miror changes that happen in Dynamo DB via. a Lambda Function

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages