aws-applicationautoscaling: Documentation not aligned with behavior for scaling SageMaker endpoints
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### 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](https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepAdjustment.html) objects
Required: No
As well, the documentation (in python):
```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`:
```typescript
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](https://docs.aws.amazon.com/sagemaker/latest/dg/async-inference-autoscale.html#async-inference-autoscale-scale-up)
[StepScalingPolicyConfiguration](https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html)
Contributor guide
Research direction
No repository file or test is named. Start at the TypeScript scalableTarget.scaleOnMetric call and compare its scalingSteps validation with the linked AWS StepScalingPolicyConfiguration documentation; reproduce the error and determine whether the reported mismatch is in the CDK behavior or the documentation. Done means the discrepancy and expected one-step behavior are resolved and covered by relevant validation or documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100