# 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.

- Source: [`aws-lambda/lib/capacity-provider.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-lambda/lib/capacity-provider.ts#L267)
- Type last changed: v2.231.0 · 1 Dec 2025

## Example

```ts
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

- `metricType`: string — The predefined metric type.

- `predefinedMetricType`: string — The predefined metric type for this scaling policy.

- `targetValue`: number — The target value for the specified metric as a percentage.

  The capacity provider will scale resources to maintain this target value.

- `value`: number — The target value for the metric.

## Methods

- `cpuUtilization(targetCpuUtilization: number): TargetTrackingScalingPolicy // chainable` (static) — Creates a target tracking scaling policy for CPU utilization.

  **Parameters**

  - `targetCpuUtilization` — The target value for CPU utilization.
