CronOptions

class aws_cdk.aws_autoscaling.CronOptions(*, day=None, hour=None, minute=None, month=None, week_day=None)

Bases: object

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.

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

See:

http://crontab.org/

ExampleMetadata:

infused

Example:

import aws_cdk.aws_autoscaling as autoscaling

# fn: lambda.Function

alias = fn.add_alias("prod")

# 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

day

The day of the month to run this rule at.

Default:
  • Every day of the month

hour

The hour to run this rule at.

Default:
  • Every hour

minute

The minute to run this rule at.

Default:
  • Every minute

month

The month to run this rule at.

Default:
  • Every month

week_day

The day of the week to run this rule at.

Default:
  • Any day of the week