- Newest
- Most votes
- Most comments
Hi,
EventBridge scheduler is definitely the way to go.
Please see this article for all details: https://levelup.gitconnected.com/using-aws-eventbridge-scheduler-to-build-a-serverless-reminder-application-ba3086cf8e
The corresponding Github repo: https://github.com/ziedbentahar/aws-eventbridge-scheduler-sample?tab=readme-ov-file
Note: this article goes a bit beyond what you want to do: it gives you a programmatic way to create such programmed notifications.
Best,
Didier
You're right that scheduling tasks in AWS can sometimes seem more complex than expected, especially for seemingly simple operations. However, there are a few ways to accomplish what you're trying to do using AWS services. Let's explore a solution using EventBridge Scheduler, which is the recommended approach for scheduling tasks in AWS.
To set up your scheduled task:
-
Create a Lambda function: First, create a Lambda function that performs your desired task. This function will make the HTTP GET request to your API and then send the result via SNS. You can use libraries like 'axios' for HTTP requests and the AWS SDK for sending SNS messages.
-
Set up EventBridge Scheduler: Use EventBridge Scheduler to invoke your Lambda function on a schedule. Here's how:
a. Open the Amazon EventBridge Scheduler console. b. Create a new schedule, providing a name and description. c. Choose the schedule type (recurring) and set up your desired schedule (e.g., daily at 3 AM) using a cron expression. d. Select AWS Lambda as the target and choose your function. e. Configure any additional settings like retry policy or dead-letter queue if needed. f. Review and create the schedule.
This approach allows you to run your task serverlessly on a schedule. The Lambda function acts as an intermediary, making the API call and then using AWS services (SNS in this case) to send the message.
While it may seem more complex than a simple cron job, this serverless approach offers benefits like improved scalability, easier management of AWS resources, and integration with other AWS services.
If you prefer a simpler setup and don't mind managing a server, you could indeed use a small EC2 instance with a cron job. However, the serverless approach with Lambda and EventBridge Scheduler is generally more cost-effective and easier to manage in the long run for such periodic tasks.
Sources
Invoke a Lambda function on a schedule - AWS Lambda
Using Amazon EventBridge Scheduler with Amazon SNS - Amazon Simple Notification Service
Relevant content
- asked 3 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 6 months ago

Thank you. All this to replace a one-liner seems a little excessive 🤪