TargetTrackingScalingPolicy
- class aws_cdk.aws_lambda.TargetTrackingScalingPolicy(*args: Any, **kwargs)
Bases:
objectA 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.
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_ec2 as ec2 vpc = ec2.Vpc(self, "MyVpc") security_group = ec2.SecurityGroup(self, "SecurityGroup", vpc=vpc) capacity_provider = lambda_.CapacityProvider(self, "MyCapacityProvider", subnets=vpc.private_subnets, security_groups=[security_group], scaling_options=lambda_.ScalingOptions.manual([ lambda_.TargetTrackingScalingPolicy.cpu_utilization(70) ]) )
Attributes
- metric_type
The predefined metric type.
- predefined_metric_type
The predefined metric type for this scaling policy.
- target_value
The target value for the specified metric as a percentage.
The capacity provider will scale resources to maintain this target value.
- value
The target value for the metric.
Static Methods
- classmethod cpu_utilization(target_cpu_utilization)
Creates a target tracking scaling policy for CPU utilization.
- Parameters:
target_cpu_utilization (
Union[int,float]) – The target value for CPU utilization. The capacity provider will scale resources to maintain this target value.- Return type: