CronJobs¶
You can easily create Scheduled Tasks for your application by specifying a cronjobs block.
Example¶
cronjobs:
- name: reaper
schedule: "cron(0 9 * * ? *)"
command: ["bundle", "exec", "rake", "cron:whatever"]
Fields¶
In addition to the fields listed below, you can also specify anything in Common Task Options.
name
- (required)-
Unique name for your cron job. This will be used to create the schedule on EventBridge Scheduler. This should be a short identifier with only letters, numbers, dash or underscore.
schedule
- (required)-
The schedule expression that is used to determine when your task runs. This can be either a cron expression, a rate expression, or a one-time expression.
Expression format: EventBridge Cron/Rate Expressions
command
- (recommended)-
The command you want to run for this cronjob.
This field is not required, but it doesn't make much sense to exclude it. For details on how to specify a command, see Specifying Command/EntryPoints
description
-
An optional description that will be added to the schedule. Any string is valid here.
Default: none
disabled
-
Create this cronjob, but do not enable it. It will not run.
Default:
false
timezone
-
Sets the time zone used when interpreting the schedule expression.
This should be an IANA Timezone Identifier like
UTC
orAmerica/Los_Angeles
.Default: none (AWS will default to UTC)
start_date
-
You can set a cron to start evaluating after a specific date if needed.
If provided, must be in RFC 3339 format.
Default: none
end_date
-
Stop executing the cron job after the given date.
If provided, must be in RFC 3339 format.
Default: none
<anything from common>
-
See Common Task Options.