Skip to content
v2.278.0

BasicScheduledActionProps Struct ​

Properties for a scheduled scaling action.

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 ​

desiredCapacityoptionalnumberdesired_capacityoptionalint | floatdesiredCapacityoptionalNumberDesiredCapacityoptionaldoubleDesiredCapacityoptional*float64 #
The new desired capacity.

Default: No new desired capacity.

At the scheduled time, set the desired capacity to the given capacity.

At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.

endTimeoptionaldateend_timeoptionaldatetimeendTimeoptionalInstantEndTimeoptionalDateTimeEndTimeoptional*time.Time #
When this scheduled action expires.

Default: The rule never expires.

notes

Warning! You should not set this field! After the scheduled end time, the AutoScaling service will delete the ScheduledAction without CloudFormation's knowledge, and subsequent stack deployments that try to modify or delete this ScheduledAction will fail.

maxCapacityoptionalnumbermax_capacityoptionalint | floatmaxCapacityoptionalNumberMaxCapacityoptionaldoubleMaxCapacityoptional*float64 #
The new maximum capacity.

Default: No new maximum capacity.

At the scheduled time, set the maximum capacity to the given capacity.

At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.

minCapacityoptionalnumbermin_capacityoptionalint | floatminCapacityoptionalNumberMinCapacityoptionaldoubleMinCapacityoptional*float64 #
The new minimum capacity.

Default: No new minimum capacity.

At the scheduled time, set the minimum capacity to the given capacity.

At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.

scheduleSchedulescheduleSchedulescheduleScheduleScheduleScheduleScheduleSchedule required #
When to perform this action.

Supports cron expressions.

For more information about cron expressions, see https://en.wikipedia.org/wiki/Cron.

startTimeoptionaldatestart_timeoptionaldatetimestartTimeoptionalInstantStartTimeoptionalDateTimeStartTimeoptional*time.Time #
When this scheduled action becomes active.

Default: The rule is activate immediately.

timeZoneoptionalstringtime_zoneoptionalstrtimeZoneoptionalStringTimeZoneoptionalstringTimeZoneoptional*string = UTC #
Specifies the time zone for a cron expression.
notes

If a time zone is not provided, UTC is used by default.

Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti).

For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.