CronOptions
Struct Stable
Options to configure a cron expression.
All fields are strings so you can use complex expressions. Absence of a field implies '*' or '?', whichever one is appropriate.
| Source | aws-autoscaling/lib/schedule.ts |
|---|---|
| Type last changed |
Example
ts
declare const autoScalingGroup: autoscaling.AutoScalingGroup;
autoScalingGroup.scaleOnSchedule('PrescaleInTheMorning', {
schedule: autoscaling.Schedule.cron({ hour: '8', minute: '0' }),
minCapacity: 20,
});
autoScalingGroup.scaleOnSchedule('AllowDownscalingAtNight', {
schedule: autoscaling.Schedule.cron({ hour: '20', minute: '0' }),
minCapacity: 1
});
python
# auto_scaling_group: autoscaling.AutoScalingGroup
auto_scaling_group.scale_on_schedule("PrescaleInTheMorning",
schedule=autoscaling.Schedule.cron(hour="8", minute="0"),
min_capacity=20
)
auto_scaling_group.scale_on_schedule("AllowDownscalingAtNight",
schedule=autoscaling.Schedule.cron(hour="20", minute="0"),
min_capacity=1
)
java
AutoScalingGroup autoScalingGroup;
autoScalingGroup.scaleOnSchedule("PrescaleInTheMorning", BasicScheduledActionProps.builder()
.schedule(Schedule.cron(CronOptions.builder().hour("8").minute("0").build()))
.minCapacity(20)
.build());
autoScalingGroup.scaleOnSchedule("AllowDownscalingAtNight", BasicScheduledActionProps.builder()
.schedule(Schedule.cron(CronOptions.builder().hour("20").minute("0").build()))
.minCapacity(1)
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
AutoScalingGroup autoScalingGroup;
autoScalingGroup.ScaleOnSchedule("PrescaleInTheMorning", new BasicScheduledActionProps {
Schedule = Schedule.Cron(new CronOptions { Hour = "8", Minute = "0" }),
MinCapacity = 20
});
autoScalingGroup.ScaleOnSchedule("AllowDownscalingAtNight", new BasicScheduledActionProps {
Schedule = Schedule.Cron(new CronOptions { Hour = "20", Minute = "0" }),
MinCapacity = 1
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var autoScalingGroup AutoScalingGroup
autoScalingGroup.scaleOnSchedule(jsii.String("PrescaleInTheMorning"), &BasicScheduledActionProps{
Schedule: autoscaling.Schedule_Cron(&CronOptions{
Hour: jsii.String("8"),
Minute: jsii.String("0"),
}),
MinCapacity: jsii.Number(20),
})
autoScalingGroup.scaleOnSchedule(jsii.String("AllowDownscalingAtNight"), &BasicScheduledActionProps{
Schedule: autoscaling.Schedule_*Cron(&CronOptions{
Hour: jsii.String("20"),
Minute: jsii.String("0"),
}),
MinCapacity: jsii.Number(1),
})
Properties
The day of the month to run this rule at.
Default: Every day of the month
The hour to run this rule at.
Default: Every hour
minuteoptionalstringminuteoptionalstrminuteoptionalStringMinuteoptionalstringMinuteoptional*string #The minute to run this rule at.
Default: Every minute
The month to run this rule at.
Default: Every month
weekDayoptionalstringweek_dayoptionalstrweekDayoptionalStringWeekDayoptionalstringWeekDayoptional*string #The day of the week to run this rule at.
Default: Any day of the week