Skip to content
v2.273.0

MemoryUtilizationScalingProps Struct ​

The properties for enabling scaling based on memory utilization.

Example ​

ts
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"),
  },
  minHealthyPercent: 100,
});

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

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

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

Properties ​

disableScaleInbooleandisable_scale_inbooldisableScaleInBooleanDisableScaleInboolDisableScaleIn*bool= false#
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.

policyNamestringpolicy_namestrpolicyNameStringPolicyNamestringPolicyName*string= Automatically generated name.#
A name for the scaling policy.
scaleInCooldownDurationscale_in_cooldownDurationscaleInCooldownDurationScaleInCooldownDurationScaleInCooldownDuration= Duration.seconds(300) for the fo…#
Period after a scale in activity completes before another scale in activity can start.
default

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

scaleOutCooldownDurationscale_out_cooldownDurationscaleOutCooldownDurationScaleOutCooldownDurationScaleOutCooldownDuration= Duration.seconds(300) for the fo…#
Period after a scale out activity completes before another scale out activity can start.
default

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

targetUtilizationPercentnumbertarget_utilization_percentint | floattargetUtilizationPercentNumberTargetUtilizationPercentdoubleTargetUtilizationPercent*float64required#
The target value for memory utilization across all tasks in the service.