[45/100] #100DaysOfCloud Today, I created a DynamoDB table and triggered it using Streams and Lambda to send notification using SNS.
A DynamoDB table with data of cats that are waiting to be adopted. When the adopted field is updated to true, a Lambda will be triggered that will send an email through SNS telling them that the particular has been adopted.
A table is created with global secondary index named adopted with few Items that includes attributes that shows the ID, name and the adoption status of the cats.
By default, the adopted field is set to false assuming all the cats aren't adopted.
A SNS Topic and Subscription is created to send notification of the adoption status which will be based on the trigger or change in the DynamoDB Streams and Lambddda function.
A lambda function is created to iterate through all the records that DynamoDB passes to the Lambda function, and then publishes a message to SNS. The required permisson is given as well.
Then the Lambda Streams is enabled and a Trigger is created. When a data is modified (adopted is changed to true from false), it triggers the lambda function due to the cahnge in the DynamoDB Streams.
If that happens then an email will be sent to notify.
You can try do it by yourself by following the steps from the link below: GitHub
Top comments (0)