Scheduled Events

Jets supports Scheduled Events. This allows you to have a Lambda function run on a scheduled based. The scheduled event is a Amazon EventBridge rule.


Generate code.

jets generate job hard --type scheduled

It looks something like this.


class HardJob < ApplicationJob
  rate "10 hours"
  def perform
    puts "Do something with event #{event}"

You can use cron-like expressions

cron(0 12 * * ? *)            # runs every day at 12:00pm UTC
cron(5,35 14 * * ? *)         # runs every day, at 2:05pm and 2:35pm UTC
cron(15 10 ? * 6L 2019-2022)  # runs at 10:15am UTC on the last Friday of
                              # each month during the years 2019 to 2022

Note: The AWS Cron syntax is slightly different from the Linux cron syntax.

You can also use rate expresions

rate(1 minute)
rate(5 minutes)
rate(1 hour)
rate(1 day)

Note: Notice the singular 1 minute vs plural 5 minutes. It matters.

Tailing Logs

It helps to tail the logs and watch the event as it comes through.

jets logs -f -n hard_job-perform

Event Payloads

The event payload from the Scheduled Event is pretty simple.


  "version": "0",
  "id": "3a0b6d51-b30a-7d45-1468-acc58fff5558",
  "detail-type": "Scheduled Event",
  "source": "",
  "account": "1122334455",
  "time": "2023-12-24T15:48:05Z",
  "region": "us-west-2",
  "resources": [
  "detail": {}