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.
AWS Serverless Application Model (AWS SAM) generates an AWS::Scheduler::Schedule resource when this event type is set.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
DeadLetterConfig:
DeadLetterConfig
Description:String
EndDate:String
FlexibleTimeWindow:FlexibleTimeWindow
GroupName:String
Input:String
KmsKeyArn:String
Name:String
OmitName:Boolean
PermissionsBoundary:String
RetryPolicy:RetryPolicy
RoleArn:String
ScheduleExpression:String
ScheduleExpressionTimezone:String
StartDate:String
State: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 functionDeadLetterQueue
property, see Dead-letter queues in the AWS Lambda Developer Guide.Type: DeadLetterConfig
Required: No
AWS CloudFormation compatibility: This property is similar to the
DeadLetterConfig
property of theAWS::Scheduler::Schedule
Target
data type. The AWS SAM version of this property includes additional subproperties, in case you want AWS SAM to create the dead-letter queue for you. -
Description
-
A description of the schedule.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
Description
property of anAWS::Scheduler::Schedule
resource. -
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
AWS CloudFormation compatibility: This property is passed directly to the
EndDate
property of anAWS::Scheduler::Schedule
resource. -
FlexibleTimeWindow
-
Allows configuration of a window within which a schedule can be invoked.
Type: FlexibleTimeWindow
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
FlexibleTimeWindow
property of anAWS::Scheduler::Schedule
resource. -
GroupName
-
The name of the schedule group to associate with this schedule. If not defined, the default group is used.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
GroupName
property of anAWS::Scheduler::Schedule
resource. -
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
AWS CloudFormation compatibility: This property is passed directly to the
Input
property of anAWS::Scheduler::Schedule Target
resource. -
KmsKeyArn
-
The ARN for a KMS Key that will be used to encrypt customer data.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
KmsKeyArn
property of anAWS::Scheduler::Schedule
resource. -
Name
-
The name of the schedule. If you don't specify a name, AWS SAM generates a name in the format
and uses that ID for the schedule name.Function-Logical-ID
Event-Source-Name
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
Name
property of anAWS::Scheduler::Schedule
resource. OmitName
-
By default, AWS SAM generates and uses a schedule name in the format of
<Function-logical-ID><event-source-name>
. Set this property totrue
to have AWS CloudFormation generate a unique physical ID and use that for the schedule name instead.Type: Boolean
Required: No
Default:
false
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
-
PermissionsBoundary
-
The ARN of the policy used to set the permissions boundary for the role.
Note
If
PermissionsBoundary
is defined, AWS SAM will apply the same boundaries to the scheduler schedule's target IAM role.Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
PermissionsBoundary
property of anAWS::IAM::Role
resource. -
RetryPolicy
-
A RetryPolicy object that includes information about the retry policy settings.
Type: RetryPolicy
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
RetryPolicy
property of theAWS::Scheduler::Schedule
Target
data 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
AWS CloudFormation compatibility: This property is passed directly to the
RoleArn
property of theAWS::Scheduler::Schedule
Target
data type. -
ScheduleExpression
-
The scheduling expression that determines when and how often the scheduler schedule event runs.
Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
ScheduleExpression
property of anAWS::Scheduler::Schedule
resource. -
ScheduleExpressionTimezone
-
The timezone in which the scheduling expression is evaluated.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
ScheduleExpressionTimezone
property of anAWS::Scheduler::Schedule
resource. -
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
AWS CloudFormation compatibility: This property is passed directly to the
StartDate
property of anAWS::Scheduler::Schedule
resource. -
State
-
The state of the Scheduler schedule.
Accepted values:
DISABLED | ENABLED
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
State
property of anAWS::Scheduler::Schedule
resource.
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.