Cron
Reference doc for the `sst.aws.Cron` component.
The Cron
component lets you add cron jobs to your app.
It uses Amazon Event Bus.
Minimal example
Pass in a schedule
and a job
function that’ll be executed.
Customize the function
Constructor
Parameters
-
name
string
-
args
CronArgs
-
opts?
ComponentResourceOptions
CronArgs
function?
Type Input
<
string
|
FunctionArgs
|
“arn:aws:lambda:${string}”
>
The function that’ll be executed when the cron job runs.
You can pass in the full function props.
You can also pass in a function ARN.
schedule
Type Input
<
“
rate(${string})
”
|
“
cron(${string})
”
>
The schedule for the cron job.
You can use a rate expression.
Or a cron expression.
task?
Type Task
The task that’ll be executed when the cron job runs.
You can then pass in the task to the cron job.
transform?
transform.rule?
Type EventRuleArgs
|
(
args
:
EventRuleArgs
,
opts
:
ComponentResourceOptions
,
name
:
string
)
=>
void
Transform the EventBridge Rule resource.
transform.target?
Type EventTargetArgs
|
(
args
:
EventTargetArgs
,
opts
:
ComponentResourceOptions
,
name
:
string
)
=>
void
Transform the EventBridge Target resource.
Properties
nodes
nodes.rule
Type EventRule
The EventBridge Rule resource.
nodes.target
Type EventTarget
The EventBridge Target resource.
nodes.function
Type Output
<
Function
>
The AWS Lambda Function that’ll be invoked when the cron job runs.
nodes.job
Type Output
<
Function
>
The AWS Lambda Function that’ll be invoked when the cron job runs.