title: Can dynamodb send to sns based on some row of data it holds
body: <p>Trying to design a solution for error handling. We have a lambda that receives data from an sns topic and sends data to a legacy service that has been known to be unavailable at times.</p>
  <p>When the legacy service is down I want to send the messages to a dyanmodb table to be replayed.</p>
  <p>I want to use a circuit breaker pattern. So at the minute I am thinking of spinning up a service that will constantly poll the legacy service then some pseudo code that looks like this</p>
  <pre><code>If (legacy service changes from dead to alive){
       Send all entries from dynamo to sns topic;
  
  //This will trigger the lambda again which will hit legacy service which we know is now up
  }
  </code></pre>
  <p>The thing is, we like using serverless technologies and not sure I can have a serverless service that constantly polls, it makes sense for that to run on a server.</p>
  <p>I am looking for a nice way to do this so I am wondering is it possible to configure dynamodb to poll the legacy service and on the condition it changes from dead to alive populate the sns topic. Or any other solutions using serverless technologies.</p>
  <p>P.s I don't like the idea of running a lambda in intervals to check the dB as we could miss some down time, also reading data from dB and sending to sns could be a lengthy operation.</p>
  <p><strong>Update: been reading into circuit pattern more and realise I don't need to constantly poll I can just check amount of failed calls in last XX seconds in my dynamodb table so a new question has arose, can I send message from dynamodb to sns depending on a condition on one of its entries. Eg. FailsInLastMinute changes from 3 to below 3 we send all the messages from a column in dynamo to sns or do I need a service for this part</strong></p>