npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lambda-cron

v1.1.3

Published

Super light weight Serverless Plugin to simplify adding cron jobs to aws lambda functions

Downloads

31

Readme

Cron Jobs for Serverless Lambda

NPM version Build

Serverless Plugin for Scheduling Lambda Cron Jobs

This plugin enables you to schedule Lambda functions with a variety of cron job frequencies. It supports different stages (dev, test, production) with options for various timing intervals such as minutes, daily, weekly, and monthly schedules.

Note: This plugin is built specifically for the AWS provider.

Table of Contents

Features

  • Configure schedules for Lambda functions across different stages.
  • Flexible scheduling options:
    • interval: Schedule to run at intervals (minutes, hours, days).
    • daily: Specific time of the day.
    • weekly: Specific day of the week at a specific time.
    • monthly: Specific day of the month at a specific time.
  • Pass custom input parameters to Lambda functions.

Installation

  • First, add it to your project as a dev dependency:

  • First, add it to your project as a dev dependency:

    • npm: npm i -D lambda-cron
    • pnpm: pnpm i -D lambda-cron
    • yarn: yarn add -D lambda-cron
  • Include it in your plugins:

    plugins:
      - lambda-cron

Schedule Configuration

Interval-Based Schedule

You can schedule a Lambda function to run at specific intervals. For example, a job with the unit minutes will run every x minutes.

unit: required - Interval unit can be one of the following:

  • days
  • hours
  • minutes

duration: required - Time interval after which the job will run again.

// The hello Lambda function will run every 2 minutes.
{
  custom: {
    'lambda-cron': {
      dev: {
        hello: {
          schedule: {
            type: 'interval',
            params: {
              unit: 'minutes',
              duration: 2,
            },
          },
        },
      },
    },
  },
}
# The hello Lambda function will run every 2 days.
custom:
  lambda-cron:
    dev:
      hello:
        schedule:
          type: interval
          params:
            unit: days
            duration: 2

Daily Schedule

With a daily schedule, you can run a job at a specific time of the day.

  • hour: required - Hour of the day in 24-hour format.
  • minute: optional - Minute of the hour (1-59). Defaults to 0 if not provided.
{
  schedule: {
    type: 'daily',
    params: {
      hour: <hour-of-the-day>, // required
      minute: <minute-of-the-hour>, // optional, defaults to 0
    },
  },
}
schedule:
  type: daily
  params:
    hour: <hour-of-the-day> # required
    minute: <minute-of-the-hour> # optional, defaults to 0

Weekly Schedule

With a weekly schedule, you can run a job on a specific day of the week at a specified time.

  • day: required - The day of the week (e.g., sunday, monday).
  • hour: optional - Hour of the day in 24-hour format (defaults to 0).
  • minute: optional - Minute of the hour (defaults to 0).
schedule:
  type: weekly
  params:
    day: <day-of-the-week> # required
    hour: <hour-of-the-day> # optional, defaults to 0
    minute: <minute-of-the-hour> # optional, defaults to 0

Monthly Schedule

With a monthly schedule, you can run a job on a specific day of the month at a specified time.

  • day: required - Day of the month (1-31).
  • hour: optional - Hour of the day in 24-hour format (defaults to 0).
  • minute: optional - Minute of the hour (defaults to 0).
schedule:
  type: monthly
  params:
    day: <day-of-the-month> # required
    hour: <hour-of-the-day> # optional, defaults to 0
    minute: <minute-of-the-hour> # optional, defaults to 0

Yearly Schedule

With a yearly schedule, you can run a job on a specific day of the year at a specified time.

  • month: required - Month of the year (1-12).
  • day: optional - Day of the month 1-31. (defaults to 1)
  • hour: optional - Hour of the day in 24-hour format (defaults to 0).
  • minute: optional - Minute of the hour (defaults to 0).
schedule:
  type: yearly
  params:
    month: <month-oof-the-year> # required
    day: <day-of-the-month> # optional, defaults to 1
    hour: <hour-of-the-day> # optional, defaults to 0
    minute: <minute-of-the-hour> # optional, defaults to 0

Configuration Example

Below is an example of how to configure the lambda-cron plugin for the dev stage:

TypeScript Example

{
  service: 'aws-serverless-typescript-project',
  frameworkVersion: '3',
  plugins: ['serverless-esbuild', 'lambda-cron'],
  provider: {
    name: 'aws',
  },
  functions: {
    hello,
    books
  },
  custom: {
    'lambda-cron': {
      dev: {
        books: {
          schedule: {
            type: 'interval',
            params: {
              unit: 'minute',
              duration: 2,
            },
          },
          input: {
            key: 'value',
          },
        },
      },
    },
  },
}

YAML Example

service: aws-serverless-typescript-project
frameworkVersion: '3'

plugins:
  - serverless-esbuild
  - lambda-cron

provider:
  name: aws
  runtime: nodejs20.x

custom:
  lambda-cron:
    dev:
      books:
        schedule:
          type: monthly
          params:
            day: 2
            hour: 2
            minute: 2
        input:
          key: value