Sample AWS Lambda handler triggered by a scheduled CloudWatch Events / EventBridge rule.
No external input beyond the EventBridge event envelope; simply logs execution
and returns structured metadata for CloudWatch Logs visibility.
Configure the schedule via serverless.yml in the functions section:
rate(5 minutes) — every 5 minutes
rate(1 hour) — every hour
cron(0 8 * * ? *) — every day at 08:00 UTC
cron(0 0 ? * MON *) — every Monday at midnight UTC
The handler receives the raw ScheduledEvent envelope from EventBridge detailing
the trigger source, account, and region, then returns execution metadata visible
in CloudWatch Logs for monitoring and auditing.
Returns
Execution result with status, timestamps, and metadata
Example
// Scheduled to run every 5 minutes by EventBridge constresult = awaitscheduledHandler(event, context); // { // status: 'ok', // executedAt: '2026-05-12T15:23:45.123Z', // requestId: 'xxxx-xxxx-xxxx', // source: 'aws.events', // account: '123456789012', // region: 'ap-southeast-1' // }
Function
scheduledHandler
Sample AWS Lambda handler triggered by a scheduled CloudWatch Events / EventBridge rule. No external input beyond the EventBridge event envelope; simply logs execution and returns structured metadata for CloudWatch Logs visibility.
Configure the schedule via
serverless.ymlin the functions section:rate(5 minutes)— every 5 minutesrate(1 hour)— every hourcron(0 8 * * ? *)— every day at 08:00 UTCcron(0 0 ? * MON *)— every Monday at midnight UTCThe handler receives the raw
ScheduledEventenvelope from EventBridge detailing the trigger source, account, and region, then returns execution metadata visible in CloudWatch Logs for monitoring and auditing.Returns
Execution result with status, timestamps, and metadata
Example
Author
Bayu Dwiyan Satria
Since
1.0.0
See
ScheduledRunResult