Class MemoryUtilizationScalingProps
The properties for enabling scaling based on memory utilization.
Inherited Members
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class MemoryUtilizationScalingProps : IMemoryUtilizationScalingProps, IBaseTargetTrackingProps
Syntax (vb)
Public Class MemoryUtilizationScalingProps Implements IMemoryUtilizationScalingProps, IBaseTargetTrackingProps
Remarks
ExampleMetadata: infused
Examples
Cluster cluster;
var loadBalancedFargateService = new ApplicationLoadBalancedFargateService(this, "Service", new ApplicationLoadBalancedFargateServiceProps {
Cluster = cluster,
MemoryLimitMiB = 1024,
DesiredCount = 1,
Cpu = 512,
TaskImageOptions = new ApplicationLoadBalancedTaskImageOptions {
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
},
MinHealthyPercent = 100
});
var scalableTarget = loadBalancedFargateService.Service.AutoScaleTaskCount(new EnableScalingProps {
MinCapacity = 1,
MaxCapacity = 20
});
scalableTarget.ScaleOnCpuUtilization("CpuScaling", new CpuUtilizationScalingProps {
TargetUtilizationPercent = 50
});
scalableTarget.ScaleOnMemoryUtilization("MemoryScaling", new MemoryUtilizationScalingProps {
TargetUtilizationPercent = 50
});
Synopsis
Constructors
| MemoryUtilizationScalingProps() | The properties for enabling scaling based on memory utilization. |
Properties
| DisableScaleIn | Indicates whether scale in by the target tracking policy is disabled. |
| PolicyName | A name for the scaling policy. |
| ScaleInCooldown | Period after a scale in activity completes before another scale in activity can start. |
| ScaleOutCooldown | Period after a scale out activity completes before another scale out activity can start. |
| TargetUtilizationPercent | The target value for memory utilization across all tasks in the service. |
Constructors
MemoryUtilizationScalingProps()
The properties for enabling scaling based on memory utilization.
public MemoryUtilizationScalingProps()
Remarks
ExampleMetadata: infused
Examples
Cluster cluster;
var loadBalancedFargateService = new ApplicationLoadBalancedFargateService(this, "Service", new ApplicationLoadBalancedFargateServiceProps {
Cluster = cluster,
MemoryLimitMiB = 1024,
DesiredCount = 1,
Cpu = 512,
TaskImageOptions = new ApplicationLoadBalancedTaskImageOptions {
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
},
MinHealthyPercent = 100
});
var scalableTarget = loadBalancedFargateService.Service.AutoScaleTaskCount(new EnableScalingProps {
MinCapacity = 1,
MaxCapacity = 20
});
scalableTarget.ScaleOnCpuUtilization("CpuScaling", new CpuUtilizationScalingProps {
TargetUtilizationPercent = 50
});
scalableTarget.ScaleOnMemoryUtilization("MemoryScaling", new MemoryUtilizationScalingProps {
TargetUtilizationPercent = 50
});
Properties
DisableScaleIn
Indicates whether scale in by the target tracking policy is disabled.
public bool? DisableScaleIn { get; set; }
Property Value
bool?
Remarks
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.
Default: false
PolicyName
A name for the scaling policy.
public string? PolicyName { get; set; }
Property Value
Remarks
Default: - Automatically generated name.
ScaleInCooldown
Period after a scale in activity completes before another scale in activity can start.
public Duration? ScaleInCooldown { get; set; }
Property Value
Remarks
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
ScaleOutCooldown
Period after a scale out activity completes before another scale out activity can start.
public Duration? ScaleOutCooldown { get; set; }
Property Value
Remarks
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
TargetUtilizationPercent
The target value for memory utilization across all tasks in the service.
public double TargetUtilizationPercent { get; set; }
Property Value
Remarks
ExampleMetadata: infused