ScheduleV2
The object describing a ScheduleV2 event source type, which sets your
serverless function as the target of an Amazon EventBridge Scheduler event that triggers on a schedule.
For more information, see What is Amazon EventBridge Scheduler? in
the EventBridge Scheduler User Guide.
Amazon Serverless Application Model (Amazon SAM) generates an AWS::Scheduler::Schedule resource when this event type is set.
Syntax
To declare this entity in your Amazon Serverless Application Model (Amazon SAM) template, use the following syntax.
YAML
DeadLetterConfig:DeadLetterConfigDescription:StringEndDate:StringFlexibleTimeWindow:FlexibleTimeWindowGroupName:StringInput:StringKmsKeyArn:StringName:StringOmitName:BooleanPermissionsBoundary:StringRetryPolicy:RetryPolicyRoleArn:StringScheduleExpression:StringScheduleExpressionTimezone:StringStartDate:StringState:String
Properties
-
DeadLetterConfig -
Configure the Amazon Simple Queue Service (Amazon SQS) queue where EventBridge sends events after a failed target invocation. Invocation can fail, for example, when sending an event to a Lambda function that doesn't exist, or when EventBridge has insufficient permissions to invoke the Lambda function. For more information, see Configuring a dead-letter queue for EventBridge Scheduler in the EventBridge Scheduler User Guide.
Note
The AWS::Serverless::Function resource type has a similar data type,
DeadLetterQueue, which handles failures that occur after successful invocation of the target Lambda function. Examples of these types of failures include Lambda throttling, or errors returned by the Lambda target function. For more information about the functionDeadLetterQueueproperty, see Dead-letter queues in the Amazon Lambda Developer Guide.Type: DeadLetterConfig
Required: No
Amazon CloudFormation compatibility: This property is similar to the
DeadLetterConfigproperty of theAWS::Scheduler::ScheduleTargetdata type. The Amazon SAM version of this property includes additional subproperties, in case you want Amazon SAM to create the dead-letter queue for you. -
Description -
A description of the schedule.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Descriptionproperty of anAWS::Scheduler::Scheduleresource. -
EndDate -
The date, in UTC, before which the schedule can invoke its target. Depending on the schedule's recurrence expression, invocations might stop on, or before, the EndDate you specify.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
EndDateproperty of anAWS::Scheduler::Scheduleresource. -
FlexibleTimeWindow -
Allows configuration of a window within which a schedule can be invoked.
Type: FlexibleTimeWindow
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
FlexibleTimeWindowproperty of anAWS::Scheduler::Scheduleresource. -
GroupName -
The name of the schedule group to associate with this schedule. If not defined, the default group is used.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
GroupNameproperty of anAWS::Scheduler::Scheduleresource. -
Input -
Valid JSON text passed to the target. If you use this property, nothing from the event text itself is passed to the target.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Inputproperty of anAWS::Scheduler::Schedule Targetresource. -
KmsKeyArn -
The ARN for a KMS Key that will be used to encrypt customer data.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
KmsKeyArnproperty of anAWS::Scheduler::Scheduleresource. -
Name -
The name of the schedule. If you don't specify a name, Amazon SAM generates a name in the format
and uses that ID for the schedule name.Function-Logical-IDEvent-Source-NameType: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Nameproperty of anAWS::Scheduler::Scheduleresource. OmitName-
By default, Amazon SAM generates and uses a schedule name in the format of
<Function-logical-ID><event-source-name>. Set this property totrueto have Amazon CloudFormation generate a unique physical ID and use that for the schedule name instead.Type: Boolean
Required: No
Default:
falseAmazon CloudFormation compatibility: This property is unique to Amazon SAM and doesn't have an Amazon CloudFormation equivalent.
-
PermissionsBoundary -
The ARN of the policy used to set the permissions boundary for the role.
Note
If
PermissionsBoundaryis defined, Amazon SAM will apply the same boundaries to the scheduler schedule's target IAM role.Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
PermissionsBoundaryproperty of anAWS::IAM::Roleresource. -
RetryPolicy -
A RetryPolicy object that includes information about the retry policy settings.
Type: RetryPolicy
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
RetryPolicyproperty of theAWS::Scheduler::ScheduleTargetdata type. -
RoleArn -
The ARN of the IAM role that EventBridge Scheduler will use for the target when the schedule is invoked.
Type: RoleArn
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
RoleArnproperty of theAWS::Scheduler::ScheduleTargetdata type. -
ScheduleExpression -
The scheduling expression that determines when and how often the scheduler schedule event runs.
Type: String
Required: Yes
Amazon CloudFormation compatibility: This property is passed directly to the
ScheduleExpressionproperty of anAWS::Scheduler::Scheduleresource. -
ScheduleExpressionTimezone -
The timezone in which the scheduling expression is evaluated.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
ScheduleExpressionTimezoneproperty of anAWS::Scheduler::Scheduleresource. -
StartDate -
The date, in UTC, after which the schedule can begin invoking a target. Depending on the schedule's recurrence expression, invocations might occur on, or after, the StartDate you specify.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
StartDateproperty of anAWS::Scheduler::Scheduleresource. -
State -
The state of the Scheduler schedule.
Accepted values:
DISABLED | ENABLEDType: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Stateproperty of anAWS::Scheduler::Scheduleresource.
Examples
Basic example of defining a ScheduleV2 resource
Resources: Function: Properties: ... Events: ScheduleEvent: Type: ScheduleV2 Properties: ScheduleExpression: "rate(1 minute)" ComplexScheduleEvent: Type: ScheduleV2 Properties: ScheduleExpression: rate(1 minute) FlexibleTimeWindow: Mode: FLEXIBLE MaximumWindowInMinutes: 5 StartDate: '2022-12-28T12:00:00.000Z' EndDate: '2023-01-28T12:00:00.000Z' ScheduleExpressionTimezone: UTC RetryPolicy: MaximumRetryAttempts: 5 MaximumEventAgeInSeconds: 300 DeadLetterConfig: Type: SQS
Note
The generated physical ID of ScheduleV2 does not include stack name.