UNPKG

1.35 kBTypeScriptView Raw
1import * as appscaling from '@aws-cdk/aws-applicationautoscaling';
2import { IConstruct } from '@aws-cdk/core';
3/**
4 * Interface for scalable attributes
5 */
6export 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 */
21export 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 */
30export 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}