aws-cdk-lib.aws_applicationautoscaling.EnableScalingProps

interface EnableScalingProps

LanguageType name
.NETAmazon.CDK.AWS.ApplicationAutoScaling.EnableScalingProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapplicationautoscaling#EnableScalingProps
Javasoftware.amazon.awscdk.services.applicationautoscaling.EnableScalingProps
Pythonaws_cdk.aws_applicationautoscaling.EnableScalingProps
TypeScript (source)aws-cdk-lib » aws_applicationautoscaling » EnableScalingProps

Properties for enabling Application Auto Scaling.

Example

declare const cluster: ecs.Cluster;
const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', {
  cluster,
  memoryLimitMiB: 1024,
  desiredCount: 1,
  cpu: 512,
  taskImageOptions: {
    image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
  },
});

const scalableTarget = loadBalancedFargateService.service.autoScaleTaskCount({
  minCapacity: 1,
  maxCapacity: 20,
});

scalableTarget.scaleOnCpuUtilization('CpuScaling', {
  targetUtilizationPercent: 50,
});

scalableTarget.scaleOnMemoryUtilization('MemoryScaling', {
  targetUtilizationPercent: 50,
});

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.