aws-cdk-lib.aws_lambda.AutoScalingOptions

interface AutoScalingOptions

LanguageType name
.NETAmazon.CDK.AWS.Lambda.AutoScalingOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambda#AutoScalingOptions
Javasoftware.amazon.awscdk.services.lambda.AutoScalingOptions
Pythonaws_cdk.aws_lambda.AutoScalingOptions
TypeScript (source)aws-cdk-lib » aws_lambda » AutoScalingOptions

Properties for enabling Lambda autoscaling.

Example

import * as autoscaling from 'aws-cdk-lib/aws-autoscaling';

declare const fn: lambda.Function;
const alias = fn.addAlias('prod');

// Create AutoScaling target
const as = alias.addAutoScaling({ maxCapacity: 50 });

// Configure Target Tracking
as.scaleOnUtilization({
  utilizationTarget: 0.5,
});

// Configure Scheduled Scaling
as.scaleOnSchedule('ScaleUpInTheMorning', {
  schedule: autoscaling.Schedule.cron({ hour: '8', minute: '0'}),
  minCapacity: 20,
});

Properties

NameTypeDescription
maxCapacitynumberMaximum capacity to scale to.
minCapacity?numberMinimum capacity to scale to.

maxCapacity

Type: number

Maximum capacity to scale to.


minCapacity?

Type: number (optional, default: 1)

Minimum capacity to scale to.