Reputation: 31
Currently learning AWS workflow with lambda. I'm trying to trigger a 302 redirect when a boolean becomes true held in DynamoDB. I have no idea how to poll DynamoDB with lambda and then send the redirect back to the client through API gateway. Do I need to be using a websoket?
Upvotes: 1
Views: 2536
Reputation: 1780
You should look into AWS AppSync. It has this type of functionality built in using better methods than polling but without the same effort of implementing web sockets in API Gateway.
Here is the page on subscriptions in AppSync: https://docs.aws.amazon.com/appsync/latest/devguide/real-time-data.html
Upvotes: 0
Reputation: 54
Using websocket will be a good option to notify client from Lambda. Same situation i had recently where i have show notifications on certain client machines. API Gateway cannot be used as API gateway is binded with request. But here in your case you would not be creating any request to Lambda. You have to read dynamoDB event and notify client using websocket.
In order to poll the dyanmoDB event. You may consume the dynamoDB event in your lambda function and based on the payload available in your polled request. You may send notifications.
Upvotes: 2
Reputation: 3310
I am not still clear about your requirement.
Using dynamodb streams to trigger the lambda is possible. Dynamodb stream let you know all the events on the documents e.g. new document inserted, document updated with details of the field that got updated.
Upvotes: 0