Skip to content

aws-applicationautoscaling: Documentation not aligned with behavior for scaling SageMaker endpoints #28776

Open
@gael-ft

Description

@gael-ft

Describe the issue

In the linked docs, we can see that we need at least one StepAdjustment:

StepAdjustments
A set of adjustments that enable you to scale based on the size of the alarm breach.
At least one step adjustment is required if you are adding a new step scaling policy configuration.
Type: Array of StepAdjustment objects
Required: No

As well, the documentation (in python):

response = client.put_scaling_policy(
    PolicyName="HasBacklogWithoutCapacity-ScalingPolicy",
    ServiceNamespace="sagemaker",  # The namespace of the service that provides the resource.
    ResourceId=resource_id,  # Endpoint name
    ScalableDimension="sagemaker:variant:DesiredInstanceCount",  # SageMaker supports only Instance Count
    PolicyType="StepScaling",  # 'StepScaling' or 'TargetTrackingScaling'
    StepScalingPolicyConfiguration={
        "AdjustmentType": "ChangeInCapacity", # Specifies whether the ScalingAdjustment value in the StepAdjustment property is an absolute number or a percentage of the current capacity. 
        "MetricAggregationType": "Average", # The aggregation type for the CloudWatch metrics.
        "Cooldown": 300, # The amount of time, in seconds, to wait for a previous scaling activity to take effect. 
        "StepAdjustments": # A set of adjustments that enable you to scale based on the size of the alarm breach.
        [ 
            {
              "MetricIntervalLowerBound": 0,
              "ScalingAdjustment": 1
            }
          ]
    },    
)

But with the folowing code, I have the error Error: You must supply at least 2 intervals for autoscaling:

scalableTarget.scaleOnMetric(`${idPrefix}HasBacklogWithoutCapacityScalingPolicy`, {
  metric: new cloudwatch.Metric({
    metricName: 'HasBacklogWithoutCapacity',
    namespace: 'AWS/SageMaker',
    label: 'HasBacklogWithoutCapacity',
    period: cdk.Duration.minutes(1),
    dimensionsMap: {
      EndpointName: endpoint.endpointName!
    },
    statistic: cloudwatch.Stats.AVERAGE
  }),
  scalingSteps: [{
    change: 1,
    lower: 0,
  }],
  adjustmentType: appscaling.AdjustmentType.CHANGE_IN_CAPACITY,
  cooldown: cdk.Duration.minutes(5),
});

Links

Autoscale an asynchronous endpoint

StepScalingPolicyConfiguration

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-applicationautoscalingRelated to AWS Application Auto ScalingbugThis issue is a bug.documentationThis is a problem with documentation.effort/mediumMedium work item – several days of effortp3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions