ScalingSchedule

class aws_cdk.aws_applicationautoscaling.ScalingSchedule(*, schedule, end_time=None, max_capacity=None, min_capacity=None, start_time=None)

Bases: object

A scheduled scaling action.

Parameters:
  • schedule (Schedule) – When to perform this action.

  • end_time (Optional[datetime]) – When this scheduled action expires. Default: The rule never expires.

  • max_capacity (Union[int, float, None]) – The new maximum capacity. During the scheduled time, the current capacity is above the maximum capacity, Application Auto Scaling scales in to the maximum capacity. At least one of maxCapacity and minCapacity must be supplied. Default: No new maximum capacity

  • min_capacity (Union[int, float, None]) – The new minimum capacity. During the scheduled time, if the current capacity is below the minimum capacity, Application Auto Scaling scales out to the minimum capacity. At least one of maxCapacity and minCapacity must be supplied. Default: No new minimum capacity

  • start_time (Optional[datetime]) – When this scheduled action becomes active. Default: The rule is activate immediately

ExampleMetadata:

infused

Example:

# cluster: ecs.Cluster

load_balanced_fargate_service = ecs_patterns.ApplicationLoadBalancedFargateService(self, "Service",
    cluster=cluster,
    memory_limit_mi_b=1024,
    desired_count=1,
    cpu=512,
    task_image_options=ecsPatterns.ApplicationLoadBalancedTaskImageOptions(
        image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
    )
)

scalable_target = load_balanced_fargate_service.service.auto_scale_task_count(
    min_capacity=5,
    max_capacity=20
)

scalable_target.scale_on_schedule("DaytimeScaleDown",
    schedule=appscaling.Schedule.cron(hour="8", minute="0"),
    min_capacity=1
)

scalable_target.scale_on_schedule("EveningRushScaleUp",
    schedule=appscaling.Schedule.cron(hour="20", minute="0"),
    min_capacity=10
)

Attributes

end_time

When this scheduled action expires.

Default:

The rule never expires.

max_capacity

The new maximum capacity.

During the scheduled time, the current capacity is above the maximum capacity, Application Auto Scaling scales in to the maximum capacity.

At least one of maxCapacity and minCapacity must be supplied.

Default:

No new maximum capacity

min_capacity

The new minimum capacity.

During the scheduled time, if the current capacity is below the minimum capacity, Application Auto Scaling scales out to the minimum capacity.

At least one of maxCapacity and minCapacity must be supplied.

Default:

No new minimum capacity

schedule

When to perform this action.

start_time

When this scheduled action becomes active.

Default:

The rule is activate immediately