I have an EC2 service that writes data to a DynamoDB table. I also have an app that is totally unrelated to the service. Now I want the app to display components in its UI based off the status
attribute of items in the DynamoDB table.
It looks like I can have the app UI subscribe to a DynamoDB Stream. However, I need data in my table to persist for >24hrs, data in DDB Streams older than 24hrs is susceptible to removal.
I would ideally like a solution where on each new DyanmoDB write/update of the status
of an item, I can send a notification to the app telling them of the change which would render a change in their UI. How can I go about making the app constantly listen, and how do I send a notification? I can't have the app directly access the database, it must go through the service.
I am new to AWS.
You do not need longer than 24 hour retention on the stream. Streams are used to emit each modification to your items, so with each change you notify your application.
Two ways I can think of to do this, both use DynamoDB streams and Lambda.
Amazon Simple Notification Service (SNS) is a two way messaging service which you can have your application subscribe to a topic. For every change made to to your DynamoDB table you write that to an SNS topic and your application will receive the changes to render the UI.
https://aws.amazon.com/pub-sub-messaging/
An altern to SNS messaging is API Gateway Websocket which allows your application subscribe to a network connection. This is more useful if you need short lived notification for given events.