class TargetTrackingScalingPolicy
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Lambda.TargetTrackingScalingPolicy |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslambda#TargetTrackingScalingPolicy |
Java | software.amazon.awscdk.services.lambda.TargetTrackingScalingPolicy |
Python | aws_cdk.aws_lambda.TargetTrackingScalingPolicy |
TypeScript (source) | aws-cdk-lib » aws_lambda » TargetTrackingScalingPolicy |
A target tracking scaling policy that automatically adjusts the capacity provider's compute resources to maintain a specified target value by tracking the required CloudWatch metric.
Example
import * as ec2 from 'aws-cdk-lib/aws-ec2';
const vpc = new ec2.Vpc(this, 'MyVpc');
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc });
const capacityProvider = new lambda.CapacityProvider(this, 'MyCapacityProvider', {
subnets: vpc.privateSubnets,
securityGroups: [securityGroup],
scalingOptions: lambda.ScalingOptions.manual([
lambda.TargetTrackingScalingPolicy.cpuUtilization(70),
]),
});
Properties
| Name | Type | Description |
|---|---|---|
| metric | string | The predefined metric type. |
| predefined | string | The predefined metric type for this scaling policy. |
| target | number | The target value for the specified metric as a percentage. |
| value | number | The target value for the metric. |
metricType
Type:
string
The predefined metric type.
predefinedMetricType
Type:
string
The predefined metric type for this scaling policy.
targetValue
Type:
number
The target value for the specified metric as a percentage.
The capacity provider will scale resources to maintain this target value.
value
Type:
number
The target value for the metric.
Methods
| Name | Description |
|---|---|
| static cpu | Creates a target tracking scaling policy for CPU utilization. |
static cpuUtilization(targetCpuUtilization)
public static cpuUtilization(targetCpuUtilization: number): TargetTrackingScalingPolicy
Parameters
- targetCpuUtilization
number— The target value for CPU utilization.
Returns
Creates a target tracking scaling policy for CPU utilization.

.NET
Go
Java
Python
TypeScript (