IScalableFunctionAttribute

class aws_cdk.aws_lambda.IScalableFunctionAttribute(*args, **kwargs)

Bases: IConstruct, Protocol

Interface for scalable attributes.

Methods

scale_on_schedule(id, *, schedule, end_time=None, max_capacity=None, min_capacity=None, start_time=None, time_zone=None)

Scale out or in based on schedule.

Parameters:
  • id (str) –

  • 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

  • time_zone (Optional[TimeZone]) – The time zone used when referring to the date and time of a scheduled action, when the scheduled action uses an at or cron expression. Default: - UTC

Return type:

None

scale_on_utilization(*, utilization_target, disable_scale_in=None, policy_name=None, scale_in_cooldown=None, scale_out_cooldown=None)

Scale out or in to keep utilization at a given level.

The utilization is tracked by the LambdaProvisionedConcurrencyUtilization metric, emitted by lambda. See: https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html#monitoring-metrics-concurrency

Parameters:
  • utilization_target (Union[int, float]) – Utilization target for the attribute. For example, .5 indicates that 50 percent of allocated provisioned concurrency is in use.

  • disable_scale_in (Optional[bool]) – Indicates whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target tracking policy won’t remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking policy can remove capacity from the scalable resource. Default: false

  • policy_name (Optional[str]) – A name for the scaling policy. Default: - Automatically generated name.

  • scale_in_cooldown (Optional[Duration]) – Period after a scale in activity completes before another scale in activity can start. Default: Duration.seconds(300) for the following scalable targets: ECS services, Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, Amazon SageMaker endpoint variants, Custom resources. For all other scalable targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB global secondary indexes, Amazon Comprehend document classification endpoints, Lambda provisioned concurrency

  • scale_out_cooldown (Optional[Duration]) – Period after a scale out activity completes before another scale out activity can start. Default: Duration.seconds(300) for the following scalable targets: ECS services, Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, Amazon SageMaker endpoint variants, Custom resources. For all other scalable targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB global secondary indexes, Amazon Comprehend document classification endpoints, Lambda provisioned concurrency

Return type:

None

Attributes

node

The tree node.