1

I have made an app in React Native, that posts to an AppSync graphql end point some data.

Using a RaspberryPi I would like to subscribe to changes that get made to the underlying DynamoDB.

I have access to the AWS ecosystem and I'm comfortable in JS and Python.

My question is what is the best way to subscribe to DynamoDB changes in the RapberryPi?

Adam
  • 350
  • 1
  • 5
  • 15
  • 3
    Possible duplicate of [How to subscribe to changes in DynamoDB](https://stackoverflow.com/questions/51495112/how-to-subscribe-to-changes-in-dynamodb) – James Whiteley Oct 11 '19 at 15:26
  • 1
    DynamoDB Streams -> Lambda -> expose an endpoint on your Pi for this to hit – James Whiteley Oct 11 '19 at 15:27
  • 1
    @JamesWhiteley You can't do what you are suggesting "DynamoDB Streams -> Lambda -> expose an endpoint on your Pi for this to hit". You would end up with DynamoDB triggering one Lambda invocation, and API Gateway triggering a different Lambda invocation. There would be no way to get the DynamoDB data over to the Lambda invocation serving the API Gateway request. – Mark B Oct 11 '19 at 15:38

1 Answers1

2

My question is what is the best way to subscribe to DynamoDB changes in the RapberryPi?

As already commented, good start would be using the Dynamo DB streams - I'd suggest to bind a lambda function to the stream. In theory there are other ways to process the update stream (kinesis,..), but for the start the lambda may be a good choice for your case. With the lambda you may store the messages to a service, where your device could pick it up.

The second part is - how do you get the updates to your raspberry pi. I'd suggest using the SQS (you can use long polling ) or IoT topic (with mqtt).

gusto2
  • 11,210
  • 2
  • 17
  • 36
  • I'm having a look at SQS and IoT (mqtT) now. It's that implementation I'm unsure about. – Adam Oct 14 '19 at 09:54
  • @Adam The main idea is that your device could pull (read) messages intended for the device. I am not sure if you can make a durable subscription with an IoT topic (so you could receive messages occurred while disconnected). That may be decisive factor between IoT and SQS service – gusto2 Oct 14 '19 at 09:57