1 | import * as appscaling from '@aws-cdk/aws-applicationautoscaling';
|
2 | import { IConstruct } from '@aws-cdk/core';
|
3 | /**
|
4 | * Interface for scalable attributes
|
5 | */
|
6 | export interface IScalableFunctionAttribute extends IConstruct {
|
7 | /**
|
8 | * Scale out or in to keep utilization at a given level. The utilization is tracked by the
|
9 | * LambdaProvisionedConcurrencyUtilization metric, emitted by lambda. See:
|
10 | * https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html#monitoring-metrics-concurrency
|
11 | */
|
12 | scaleOnUtilization(options: UtilizationScalingOptions): void;
|
13 | /**
|
14 | * Scale out or in based on schedule.
|
15 | */
|
16 | scaleOnSchedule(id: string, actions: appscaling.ScalingSchedule): void;
|
17 | }
|
18 | /**
|
19 | * Options for enabling Lambda utilization tracking
|
20 | */
|
21 | export interface UtilizationScalingOptions extends appscaling.BaseTargetTrackingProps {
|
22 | /**
|
23 | * Utilization target for the attribute. For example, .5 indicates that 50 percent of allocated provisioned concurrency is in use.
|
24 | */
|
25 | readonly utilizationTarget: number;
|
26 | }
|
27 | /**
|
28 | * Properties for enabling Lambda autoscaling
|
29 | */
|
30 | export interface AutoScalingOptions {
|
31 | /**
|
32 | * Minimum capacity to scale to
|
33 | *
|
34 | * @default 1
|
35 | */
|
36 | readonly minCapacity?: number;
|
37 | /**
|
38 | * Maximum capacity to scale to
|
39 | */
|
40 | readonly maxCapacity: number;
|
41 | }
|