How to Trigger a Lambda Function Every 5–10 Seconds

Overview: serverless.yml

Note that I set provider.eventBridge.useCloudFormation to true on line 10 so that the EventBridge rule is created using CloudFormation instead of a Custom Resource. This requires Serverless Framework >= 2.27.0.

Function: everyminute

Function: interval

SQS Queue

How accurate is it?

The raw invocation times times on GitHub.

Enhancements

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store