VOOZH about

URL: https://thenewstack.io/move-your-cron-jobs-to-serverless-in-3-steps/

⇱ Move Your Cron Jobs to Serverless in 3 Steps - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2018-09-11 09:00:40
Move Your Cron Jobs to Serverless in 3 Steps
contributed,sponsor-stackery,sponsored,sponsored-post-contributed,tutorial,
Serverless

Move Your Cron Jobs to Serverless in 3 Steps

How to use the cron scheduler to manage your serverless jobs.
Sep 11th, 2018 9:00am by Nočnica Mellifera
👁 Featued image for: Move Your Cron Jobs to Serverless in 3 Steps
Featured image via Pixabay.
Stackery sponsored this post.
Toby Fee
Toby is a community developer at Stackery. Her roles and experience combine working as a software engineer, writer and technology instructor, building interesting projects with emerging tools and sharing her findings with the world. Prior to joining Stackery, Toby was an engineer at NWEA, Vacasa and New Relic.

Cron jobs are often the night shift of our web applications. Some tasks just don’t make sense to do in real time or during peak usage, and need to be scheduled to happen periodically. Cron jobs have two notorious problems:

  • Relatively Opaque Configuration: Like Regex or SQL, cron has a compact and consistent syntax that, if you don’t know it, is almost impossible to read.
  • Observability: Once your team has multiple jobs scheduled across multiple servers, it can be very difficult to make sure that everyone knows which cron jobs need to be run, where they are, and how to move them to new systems.

Using Amazon Web Services (AWS) we could move all of our cron jobs inside an EC2 Linux server. This would at least make it easier to backup and clone the machine with all of our tasks, but we’re still in the position of having to know how to read a crontab file, and maintain a whole server just to run some code periodically.

This tutorial will show you how to schedule a Lambda function to run periodically, moving your scheduled tasks to serverless. You can use this technique to kick off DB maintenance, run nightly tasks or send regular reports to your team.

1. Make a Lambda Function

If you’d like to do this directly in AWS Start by creating a simple Lambda from within Amazon Web Services.

👁 Image

Our Lambda will be the simplest possible thing: a static log message. Scroll down to the code editor and enter the following few lines

exports.handler = async (event) => {
console.log('this is just a periodic reminder')
return {};
};
👁 Image

After that, save your Lambda.

2. Recurring Cloudwatch Triggers

The next step is creating a new “rule” for Cloudwatch to regularly trigger our Lambda. From the Cloudwatch console, select “Rules>Create Rule.”

👁 Image

You can enter a crontab line here or select a simple interval from the drop-down.

👁 Image

Note that crontab offers a lot more than “every X minutes/hours/days,” and if you’re not familiar with the syntax, the crontab generator can help you write a rule such as “every Thursday every other month.” Select the Lambda we just created as our target. Once the rule is saved, we should see the Lambda invoked every X interval.

3. Seeing It in Action

To see this Lambda being exercised, we’ll need to check the logs since our Lambda sent no outbound traffic. Go to the AWS Lambda dashboard, and select the pertinent Lambda.

👁 Image

From there, select “Monitoring” and go to the log display.

👁 Image

The Fast and Simple Way

Here I must note: if you’d like to save yourself a great deal of time and clicking around AWS’ menus, Stackery greatly improves and simplifies the process down to two steps. Full disclosure: I work for Stackery and find this product feature to be amazing.

  1. Drag in a Lambda resource.
  2. Connect a timer. That’s all.

👁 Image

Further Reading

There in an official AWS tutorial on this topic covers similar material, and how to trigger the Lambda-based on other events. The AWS developer guide has additional use case resources if you’d like to learn more about getting started with serverless.

Stackery is a serverless platform to design, develop and deliver modern applications. Stackery provides intuitive automation, predictable performance, and operational control over server-less applications and infrastructure.
Learn More
The latest from Stackery
TRENDING STORIES
Nočnica Mellifera (She/Her) was a developer for seven years before moving into developer relations. She specializes in containerized workloads, serverless, and public cloud engineering. Nočnica has long been an advocate for open standards, and has given talks and workshops on...
Read more from Nočnica Mellifera
Stackery sponsored this post.
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.