class Schedule
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Events.Schedule |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsevents#Schedule |
Java | software.amazon.awscdk.services.events.Schedule |
Python | aws_cdk.aws_events.Schedule |
TypeScript (source) | aws-cdk-lib » aws_events » Schedule |
Schedule for scheduled event rules.
Note that rates cannot be defined in fractions of minutes.
See also: https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html
Example
import * as redshiftserverless from 'aws-cdk-lib/aws-redshiftserverless'
declare const workgroup: redshiftserverless.CfnWorkgroup;
const rule = new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
const dlq = new sqs.Queue(this, 'DeadLetterQueue');
rule.addTarget(new targets.RedshiftQuery(workgroup.attrWorkgroupWorkgroupArn, {
database: 'dev',
deadLetterQueue: dlq,
sql: ['SELECT * FROM foo','SELECT * FROM baz'],
}));
Initializer
new Schedule()
Properties
| Name | Type | Description |
|---|---|---|
| expression | string | Retrieve the expression for this schedule. |
expressionString
Type:
string
Retrieve the expression for this schedule.
Methods
| Name | Description |
|---|---|
| static cron(options) | Create a schedule from a set of cron fields. |
| static expression(expression) | Construct a schedule from a literal schedule expression. |
| static rate(duration) | Construct a schedule from an interval and a time unit. |
static cron(options)
public static cron(options: CronOptions): Schedule
Parameters
- options
CronOptions
Returns
Create a schedule from a set of cron fields.
static expression(expression)
public static expression(expression: string): Schedule
Parameters
- expression
string— The expression to use.
Returns
Construct a schedule from a literal schedule expression.
static rate(duration)
public static rate(duration: Duration): Schedule
Parameters
- duration
Duration
Returns
Construct a schedule from an interval and a time unit.
Rates may be defined with any unit of time, but when converted into minutes, the duration must be a positive whole number of minutes.

.NET
Go
Java
Python
TypeScript (