BasicTargetTrackingScalingPolicyProps Struct
Properties for a Target Tracking policy that include the metric but exclude the target.
Example
const shardsScalableTarget = new appscaling.ScalableTarget(this, 'ElastiCacheRedisShardsScalableTarget', {
serviceNamespace: appscaling.ServiceNamespace.ELASTICACHE,
scalableDimension: 'elasticache:replication-group:NodeGroups',
minCapacity: 2,
maxCapacity: 10,
resourceId: 'replication-group/main-cluster',
});
shardsScalableTarget.scaleToTrackMetric('ElastiCacheRedisShardsCPUUtilization', {
targetValue: 20,
predefinedMetric: appscaling.PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION,
});
shards_scalable_target = appscaling.ScalableTarget(self, "ElastiCacheRedisShardsScalableTarget",
service_namespace=appscaling.ServiceNamespace.ELASTICACHE,
scalable_dimension="elasticache:replication-group:NodeGroups",
min_capacity=2,
max_capacity=10,
resource_id="replication-group/main-cluster"
)
shards_scalable_target.scale_to_track_metric("ElastiCacheRedisShardsCPUUtilization",
target_value=20,
predefined_metric=appscaling.PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION
)
ScalableTarget shardsScalableTarget = ScalableTarget.Builder.create(this, "ElastiCacheRedisShardsScalableTarget")
.serviceNamespace(ServiceNamespace.ELASTICACHE)
.scalableDimension("elasticache:replication-group:NodeGroups")
.minCapacity(2)
.maxCapacity(10)
.resourceId("replication-group/main-cluster")
.build();
shardsScalableTarget.scaleToTrackMetric("ElastiCacheRedisShardsCPUUtilization", BasicTargetTrackingScalingPolicyProps.builder()
.targetValue(20)
.predefinedMetric(PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION)
.build());
// Install: dotnet add package Amazon.CDK.Lib
var shardsScalableTarget = new ScalableTarget(this, "ElastiCacheRedisShardsScalableTarget", new ScalableTargetProps {
ServiceNamespace = ServiceNamespace.ELASTICACHE,
ScalableDimension = "elasticache:replication-group:NodeGroups",
MinCapacity = 2,
MaxCapacity = 10,
ResourceId = "replication-group/main-cluster"
});
shardsScalableTarget.ScaleToTrackMetric("ElastiCacheRedisShardsCPUUtilization", new BasicTargetTrackingScalingPolicyProps {
TargetValue = 20,
PredefinedMetric = PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
shardsScalableTarget := appscaling.NewScalableTarget(this, jsii.String("ElastiCacheRedisShardsScalableTarget"), &ScalableTargetProps{
ServiceNamespace: appscaling.ServiceNamespace_ELASTICACHE,
ScalableDimension: jsii.String("elasticache:replication-group:NodeGroups"),
MinCapacity: jsii.Number(2),
MaxCapacity: jsii.Number(10),
ResourceId: jsii.String("replication-group/main-cluster"),
})
shardsScalableTarget.ScaleToTrackMetric(jsii.String("ElastiCacheRedisShardsCPUUtilization"), &BasicTargetTrackingScalingPolicyProps{
TargetValue: jsii.Number(20),
PredefinedMetric: appscaling.PredefinedMetric_ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION,
})
Properties
customMetricoptionalIMetriccustom_metricoptionalIMetriccustomMetricoptionalIMetricCustomMetricoptionalIMetricCustomMetricoptionalIMetric#Default: No custom metric.
notes
The metric must track utilization. Scaling out will happen if the metric is higher than the target value, scaling in will happen in the metric is lower than the target value.
The metric must be in the same account and region as the scaling policy.
Exactly one of customMetric or predefinedMetric must be specified.
disableScaleInoptionalbooleandisable_scale_inoptionalbooldisableScaleInoptionalBooleanDisableScaleInoptionalboolDisableScaleInoptional*bool= false#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.
policyNameoptionalstringpolicy_nameoptionalstrpolicyNameoptionalStringPolicyNameoptionalstringPolicyNameoptional*string#Default: Automatically generated name.
predefinedMetricoptionalPredefinedMetricpredefined_metricoptionalPredefinedMetricpredefinedMetricoptionalPredefinedMetricPredefinedMetricoptionalPredefinedMetricPredefinedMetricoptionalPredefinedMetric#Default: No predefined metrics.
notes
The metric must track utilization. Scaling out will happen if the metric is higher than the target value, scaling in will happen in the metric is lower than the target value.
Exactly one of customMetric or predefinedMetric must be specified.
resourceLabeloptionalstringresource_labeloptionalstrresourceLabeloptionalStringResourceLabeloptionalstringResourceLabeloptional*string#Default: No resource label.
Only used for predefined metric ALBRequestCountPerTarget.
Example value: app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>
scaleInCooldownoptionalDurationscale_in_cooldownoptionalDurationscaleInCooldownoptionalDurationScaleInCooldownoptionalDurationScaleInCooldownoptionalDuration#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
scaleOutCooldownoptionalDurationscale_out_cooldownoptionalDurationscaleOutCooldownoptionalDurationScaleOutCooldownoptionalDurationScaleOutCooldownoptionalDuration#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
targetValuenumbertarget_valueint | floattargetValueNumberTargetValuedoubleTargetValue*float64required#