diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/README.md b/packages/aws-cdk-lib/aws-applicationautoscaling/README.md index b52ef8ad4b1d7..ada0679a43080 100644 --- a/packages/aws-cdk-lib/aws-applicationautoscaling/README.md +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/README.md @@ -247,3 +247,20 @@ shardsScalableTarget.scaleToTrackMetric('ElastiCacheRedisShardsCPUUtilization', predefinedMetric: appscaling.PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION, }); ``` + +### SageMaker variant provisioned concurrency utilization with target value + +```ts +const target = new appscaling.ScalableTarget(this, 'SageMakerVariantScalableTarget', { + serviceNamespace: appscaling.ServiceNamespace.SAGEMAKER, + scalableDimension: 'sagemaker:variant:DesiredProvisionedConcurrency', + minCapacity: 2, + maxCapacity: 10, + resourceId: 'endpoint/MyEndpoint/variant/MyVariant', +}); + +target.scaleToTrackMetric('SageMakerVariantProvisionedConcurrencyUtilization', { + targetValue: 0.9, + predefinedMetric: appscaling.PredefinedMetric.SAGEMAKER_VARIANT_PROVISIONED_CONCURRENCY_UTILIZATION, +}); +``` diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts index 097a0d5df6bff..7277fc164e1ea 100644 --- a/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts @@ -254,6 +254,16 @@ export enum PredefinedMetric { * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html */ SAGEMAKER_VARIANT_INVOCATIONS_PER_INSTANCE = 'SageMakerVariantInvocationsPerInstance', + /** + * SAGEMAKER_VARIANT_PROVISIONED_CONCURRENCY_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + SAGEMAKER_VARIANT_PROVISIONED_CONCURRENCY_UTILIZATION = 'SageMakerVariantProvisionedConcurrencyUtilization', + /** + * SAGEMAKER_INFERENCE_COMPONENT_INVOCATIONS_PER_COPY + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + SAGEMAKER_INFERENCE_COMPONENT_INVOCATIONS_PER_COPY = 'SageMakerInferenceComponentInvocationsPerCopy', /** * ECS_SERVICE_AVERAGE_CPU_UTILIZATION * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html @@ -275,18 +285,23 @@ export enum PredefinedMetric { */ KAFKA_BROKER_STORAGE_UTILIZATION = 'KafkaBrokerStorageUtilization', /** - * ELASTIC_CACHE_PRIMARY_ENGINE_CPU_UTILIZATION + * ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html */ ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION = 'ElastiCachePrimaryEngineCPUUtilization', /** - * ELASTIC_CACHE_REPLICA_ENGINE_CPU_UTILIZATION + * ELASTICACHE_REPLICA_ENGINE_CPU_UTILIZATION * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html */ ELASTICACHE_REPLICA_ENGINE_CPU_UTILIZATION = 'ElastiCacheReplicaEngineCPUUtilization', /** - * ELASTIC_CACHE_REPLICA_ENGINE_CPU_UTILIZATION + * ELASTICACHE_DATABASE_MEMORY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html */ ELASTICACHE_DATABASE_MEMORY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE = 'ElastiCacheDatabaseMemoryUsageCountedForEvictPercentage', + /** + * ELASTICACHE_DATABASE_CAPACITY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + ELASTICACHE_DATABASE_CAPACITY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE = 'ElastiCacheDatabaseCapacityUsageCountedForEvictPercentage', } diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/test/target-tracking.test.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/test/target-tracking.test.ts index ca117a8406a2f..df3c2c098d841 100644 --- a/packages/aws-cdk-lib/aws-applicationautoscaling/test/target-tracking.test.ts +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/test/target-tracking.test.ts @@ -71,6 +71,26 @@ describe('target tracking', () => { }); }); + test('test setup target tracking on predefined metric for SAGEMAKER_VARIANT_PROVISIONED_CONCURRENCY_UTILIZATION', () => { + // GIVEN + const stack = new cdk.Stack(); + const target = createScalableTarget(stack); + + // WHEN + target.scaleToTrackMetric('Tracking', { + predefinedMetric: appscaling.PredefinedMetric.SAGEMAKER_VARIANT_PROVISIONED_CONCURRENCY_UTILIZATION, + targetValue: 0.5, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { + TargetTrackingScalingPolicyConfiguration: { + PredefinedMetricSpecification: { PredefinedMetricType: 'SageMakerVariantProvisionedConcurrencyUtilization' }, + TargetValue: 0.5, + }, + }); + }); + test('test setup target tracking on custom metric', () => { // GIVEN const stack = new cdk.Stack();