How To Run A Serverless Scheduled Function Using AWS Lambda & EventBridge
A simple guide on running code on a schedule without managing any servers with AWS Lambda
AWS EventBridge, formerly known as CloudWatch Events, is a serverless service that lets you run scheduled services and integrates with a wide variety of AWS services.
In this article we’ll guide you through the easiest and quickest way to run a serverless function on a schedule we define.
With everything being serverless, we don’t need to provision servers so we can do this on-demand, making it super flexible and easy to test and use in production.
The general idea is this: we will run a scheduled event using EventBridge, which will trigger a Lambda function, which in turn will write an item to a DynamoDB table.
A typical use case in real applications where you want to add items to your table on a schedule. It can be something like adding a featured post to a blogging website.
We’ll accomplish this is 3 easy steps:
- Create a DynamoDB table
- Create a Lambda function with proper permissions
- Create a schedule rule in EventBridge
Let’s start.