I have an AWS Lambda that polls from an external server for new events every 6 hours. On every call, if there are any new events, it publishes the updated total number of events polled to a SNS. So I essentially need to call the lambda on fixed intervals but also pass a counter
state across calls.
I'm currently considering the following options:
- Store the
counter
somewhere on a EFS/S3, but it seems an overkill for a simple number - EventBridge, which would be ok to schedule the execution, but doesn't store state across calls
- A step function with a
loop
+wait
on the the lambda would do it, but it doesn't seem to be the most efficient/cost effective way to do it - use a SQS with a delay so that the lambda essentially
triggers itself, passing the updated
state
. Again I don't think this is the most effective, and to actually get to the 6 hours delay I would have to implement some checks/delays within the lambda, as the max delay for SQS is 15 minutes
What would be the best way to do it?