AutoScalingOptions

class aws_cdk.aws_lambda.AutoScalingOptions(*, max_capacity, min_capacity=None)

Bases: object

Properties for enabling Lambda autoscaling.

Parameters:
  • max_capacity (Union[int, float]) – Maximum capacity to scale to.

  • min_capacity (Union[int, float, None]) – Minimum capacity to scale to. Default: 1

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

max_capacity

Maximum capacity to scale to.

min_capacity

Minimum capacity to scale to.

Default:

1