Schedule

class aws_cdk.aws_autoscaling.Schedule

Bases: object

Schedule for scheduled scaling actions.

Example:

import aws_cdk.aws_autoscaling as autoscaling

# fn is of type Function

alias = lambda_.Alias(self, "Alias",
    alias_name="prod",
    version=fn.latest_version
)

# Create AutoScaling target
as = alias.add_auto_scaling(max_capacity=50)

# Configure Target Tracking
as.scale_on_utilization(
    utilization_target=0.5
)

# Configure Scheduled Scaling
as.scale_on_schedule("ScaleUpInTheMorning",
    schedule=autoscaling.Schedule.cron(hour="8", minute="0"),
    min_capacity=20
)

Attributes

expression_string

Retrieve the expression for this schedule.

Return type

str

Static Methods

classmethod cron(*, day=None, hour=None, minute=None, month=None, week_day=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

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 AutoScaling will recognize

See

http://crontab.org/

Return type

Schedule