Prompt
How do I run scheduled jobs in serverless?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
In serverless, you typically run scheduled jobs by using a managed scheduler rather than an always-on cron daemon.
Common ways
1) Cloud provider scheduler + function
Use a scheduler service to trigger a serverless function on a timer.
- AWS: EventBridge Scheduler / EventBridge Rules → Lambda
- Google Cloud: Cloud Scheduler → Cloud Function / Cloud Run
- Azure: Timer-triggered Azure Functions
- Vercel / Netlify / similar: built-in cron or scheduled functions
Example:
- every day at 2 AM
- scheduler invokes a function
- function does the work and exits
2) Scheduled container jobs
If the job needs more control or longer runtime:
- AWS ECS/Fargate scheduled task
- Google Cloud Run Jobs + Cloud Scheduler
- Azure Container Apps Jobs
This is still “serverless-ish” because you don’t manage servers, but it’s not a pure function.
3) External cron service
Use a third-party service that calls an HTTP endpoint or queue:
- cron-job.org
- GitHub Actions scheduled workflows
- Zapier / Make / Pipedream, etc.
Useful when your platform doesn’t have native scheduling.
What to do inside the job
Keep scheduled jobs:
- idempotent: safe if triggered twice
- short-lived if using functions
- retriable
- stateless: store state in DB / object storage / queue
- observable: log, trace, alert on failures
If the job is long-running, split it into:
- scheduler triggers a job starter
- job processes work in chunks
- queue-based workers handle load
Example pattern
- Scheduler runs every hour
- It invokes a Lambda / Function
- Function reads pending records from DB
- Function processes a batch
- Function stores progress checkpoint
- Next run continues
Important considerations
- Timeout limits: functions often have short max runtimes
- Cold starts: can affect precision
- Concurrency: prevent overlapping runs with locks
- Retries: avoid duplicate processing
- Time zones: scheduler timing is often UTC
- Cost: pay per invocation, usually cheap for infrequent jobs
If you want, I can show:
- a specific cloud example (AWS / GCP / Azure), or
- a code example for scheduling a job.