Schedule

class aws_cdk.aws_applicationautoscaling.Schedule

Bases: object

Schedule for scheduled scaling actions.

ExampleMetadata:

infused

Example:

from aws_cdk import TimeZone
# resource: SomeScalableResource


capacity = resource.auto_scale_capacity(
    min_capacity=1,
    max_capacity=50
)

capacity.scale_on_schedule("PrescaleInTheMorning",
    schedule=appscaling.Schedule.cron(hour="8", minute="0"),
    min_capacity=20,
    time_zone=TimeZone.AMERICA_DENVER
)

capacity.scale_on_schedule("AllowDownscalingAtNight",
    schedule=appscaling.Schedule.cron(hour="20", minute="0"),
    min_capacity=1,
    time_zone=TimeZone.AMERICA_DENVER
)

Attributes

expression_string

Retrieve the expression for this schedule.

Static Methods

classmethod at(moment)

Construct a Schedule from a moment in time.

Parameters:

moment (datetime) –

Return type:

Schedule

classmethod cron(*, day=None, hour=None, minute=None, month=None, week_day=None, year=None)

Create a schedule from a set of cron fields.

Parameters:
  • day (Optional[str]) – The day of the month to run this rule at. Default: - Every day of the month

  • hour (Optional[str]) – The hour to run this rule at. Default: - Every hour

  • minute (Optional[str]) – The minute to run this rule at. Default: - Every minute

  • month (Optional[str]) – The month to run this rule at. Default: - Every month

  • week_day (Optional[str]) – The day of the week to run this rule at. Default: - Any day of the week

  • year (Optional[str]) – The year to run this rule at. Default: - Every year

Return type:

Schedule

classmethod expression(expression)

Construct a schedule from a literal schedule expression.

Parameters:

expression (str) – The expression to use. Must be in a format that Application AutoScaling will recognize

Return type:

Schedule

classmethod rate(duration)

Construct a schedule from an interval and a time unit.

Parameters:

duration (Duration) –

Return type:

Schedule