Skip to content
v2.275.0

Schedule Class ​

Schedule for scheduled scaling actions.

Example ​

ts
import { TimeZone } from 'aws-cdk-lib';
declare const resource: SomeScalableResource;

const capacity = resource.autoScaleCapacity({
  minCapacity: 1,
  maxCapacity: 50,
});

capacity.scaleOnSchedule('PrescaleInTheMorning', {
  schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }),
  minCapacity: 20,
  timeZone: TimeZone.AMERICA_DENVER,
});

capacity.scaleOnSchedule('AllowDownscalingAtNight', {
  schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }),
  minCapacity: 1,
  timeZone: TimeZone.AMERICA_DENVER,
});

Initializer ​

ts
new Schedule()
python
Schedule()
java
new Schedule()
csharp
new Schedule()
go
NewSchedule()

Properties ​

expressionStringstringexpression_stringstrexpressionStringStringExpressionStringstringExpressionString*string#
Retrieve the expression for this schedule.

Methods ​

at(moment: date): Schedule // chainable@staticmethod def at(moment: datetime) -> Schedulepublic static Schedule at(Instant moment)public static Schedule At(DateTime moment)func At(Moment *time.Time) Schedulestatic#
Construct a Schedule from a moment in time.
cron(options: CronOptions): Schedule // chainable@staticmethod def cron(options: CronOptions) -> Schedulepublic static Schedule cron(CronOptions options)public static Schedule Cron(CronOptions options)func Cron(Options CronOptions) Schedulestatic#
Create a schedule from a set of cron fields.
expression(expression: string): Schedule // chainable@staticmethod def expression(expression: str) -> Schedulepublic static Schedule expression(String expression)public static Schedule Expression(string expression)func Expression(Expression *string) Schedulestatic#
Construct a schedule from a literal schedule expression.
1 parameter

Parameters

  • expressionexpressionexpressionexpressionExpression — The expression to use.
rate(duration: Duration): Schedule // chainable@staticmethod def rate(duration: Duration) -> Schedulepublic static Schedule rate(Duration duration)public static Schedule Rate(Duration duration)func Rate(Duration Duration) Schedulestatic#
Construct a schedule from an interval and a time unit.