ScheduleV2 - AWS Serverless Application Model

ScheduleV2

The object describing a ScheduleV2 event source type, which sets your state machine 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.

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.

Type: DeadLetterConfig

Required: No

AWS CloudFormation compatibility: This property is similar to the DeadLetterConfig property of the AWS::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 an AWS::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 an AWS::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 an AWS::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 an AWS::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 an AWS::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 an AWS::Scheduler::Schedule resource.

Name

The name of the schedule. If you don't specify a name, AWS SAM generates a name in the format StateMachine-Logical-IDEvent-Source-Name and uses that ID for the schedule name.

Type: String

Required: No

AWS CloudFormation compatibility: This property is passed directly to the Name property of an AWS::Scheduler::Schedule resource.

OmitName

By default, AWS SAM generates and uses a schedule name in the format of <State-machine-logical-ID><event-source-name>. Set this property to true 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 an AWS::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 the AWS::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 the AWS::Scheduler::Schedule Target data type.

ScheduleExpression

The scheduling expression that determines when and how often the schedule runs.

Type: String

Required: Yes

AWS CloudFormation compatibility: This property is passed directly to the ScheduleExpression property of an AWS::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 an AWS::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 an AWS::Scheduler::Schedule resource.

State

The state of the schedule.

Accepted values: DISABLED | ENABLED

Type: String

Required: No

AWS CloudFormation compatibility: This property is passed directly to the State property of an AWS::Scheduler::Schedule resource.

Examples

Basic example of defining a ScheduleV2 resource

StateMachine: Type: AWS::Serverless::StateMachine Properties: Name: MyStateMachine 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 DefinitionUri: Bucket: sam-demo-bucket Key: my-state-machine.asl.json Version: 3 Policies: - LambdaInvokePolicy: FunctionName: !Ref MyFunction