Updates the auto-scaling policy for an application.
Operation description
Considerations
To scale out a single application to more than 50 instances, contact SAE technical support to be added to the whitelist. For more information, see Contact us.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
sae:UpdateApplicationScalingRule |
update |
*Application
|
None | None |
Request syntax
PUT /pop/v1/sam/scale/applicationScalingRule HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| AppId |
string |
Yes |
The application ID. |
7171a6ca-d1cd-4928-8642-7d5cfe69**** |
| ScalingRuleName |
string |
Yes |
The name of the auto scaling policy. The name must start with a lowercase letter, contain only lowercase letters, digits, and hyphens (-), and be no more than 32 characters long. Note
You cannot change the policy name after the auto scaling policy is created. |
timer-0800-2100 |
| ScalingRuleTimer |
string |
No |
The configuration of the scheduled scaling policy. This parameter is required for scheduled scaling policies. The parameter includes the following fields:
|
{"beginDate":null,"endDate":null,"period":"* * *","schedules":[{"atTime":"08:00","targetReplicas":10},{"atTime":"20:00","targetReplicas":3}]} |
| ScalingRuleMetric |
string |
No |
The configuration of the metric-based scaling policy. This parameter is required for metric-based scaling policies. The parameter includes the following fields:
Note
You can specify one or more metrics. If you specify multiple metrics, a scale-out event is triggered when any of the metrics reaches its target value. The number of instances after the scale-out does not exceed the maximum number of instances. A scale-in event is triggered when all metrics are below their target values. The number of instances after the scale-in is not less than the minimum number of instances. |
{"maxReplicas":3,"minReplicas":1,"metrics":[{"metricType":"CPU","metricTargetAverageUtilization":20},{"metricType":"MEMORY","metricTargetAverageUtilization":30},{"metricType":"tcpActiveConn","metricTargetAverageUtilization":20},{"metricType":"SLB_QPS","MetricTargetAverageUtilization":25,"slbId":"lb-xxx","slbProject":"aliyun-fc-cn-hangzhou-d95881d9-5d3c-5f26-a6b8-************","slbLogstore":"function-log","vport":"80"},{"metricType":"SLB_RT","MetricTargetAverageUtilization":35,"slbId":"lb-xxx","slbProject":"aliyun-fc-cn-hangzhou-d95881d9-5d3c-5f26-a6b8-************","slbLogstore":"function-log","vport":"80"}],"scaleUpRules":{"step":"100","disabled":false,"stabilizationWindowSeconds":0},"scaleDownRules":{"step":"100","disabled":false,"stabilizationWindowSeconds":300}} |
| MinReadyInstances |
integer |
No |
The minimum number of surviving instances. Valid values:
Note
Set the minimum number of surviving instances for each rolling deployment to 1 or more to ensure business continuity. |
3 |
| MinReadyInstanceRatio |
integer |
No |
The percentage of the minimum number of surviving instances. Valid values:
Note
If you specify both MinReadyInstance and MinReadyInstanceRatio, and MinReadyInstanceRatio is not -1, MinReadyInstanceRatio takes precedence. For example, if MinReadyInstances is 5 and MinReadyInstanceRatio is 50, the system uses 50% to calculate the minimum number of surviving instances. |
-1 |
| EnableIdle |
boolean |
No |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The information returned. |
||
| RequestId |
string |
The request ID. |
91F93257-7A4A-4BD3-9A7E-2F6EAE6D**** |
| TraceId |
string |
The trace ID. You can use the trace ID to query the details of a call. |
0a98a02315955564772843261e**** |
| Data |
object |
The returned result. |
|
| Timer |
object |
The scheduled scaling policy. |
|
| EndDate |
string |
The end date of the short-term scheduled scaling policy. The following rules apply:
|
2021-04-25 |
| BeginDate |
string |
The start date of the short-term scheduled scaling policy. The following rules apply:
|
2021-03-25 |
| Schedules |
array<object> |
The points in time when the policy is triggered within a day. |
|
|
object |
The data of a point in time. |
||
| AtTime |
string |
The point in time. Format: HH:mm. |
08:00 |
| TargetReplicas |
integer |
The number of target instances. |
3 |
| MinReplicas |
integer |
The minimum number of instances. |
1 |
| MaxReplicas |
integer |
The maximum number of instances. |
10 |
| Period |
string |
The period in which the scheduled scaling policy is executed. Valid values:
|
* * * |
| UpdateTime |
integer |
The time when the scaling policy was updated. Unit: milliseconds. |
1616642248938 |
| AppId |
string |
The application ID. |
7171a6ca-d1cd-4928-8642-7d5cfe69**** |
| CreateTime |
integer |
The time when the scaling policy was created. Unit: milliseconds. |
1616642248938 |
| LastDisableTime |
integer |
The time when the scaling policy was last disabled. |
1641882854484 |
| ScaleRuleEnabled |
boolean |
Indicates whether the scaling policy is enabled. Valid values:
|
true |
| ScaleRuleType |
string |
The type of the scaling policy. Valid values:
|
timing |
| Metric |
object |
The metric-based scaling policy. |
|
| Metrics |
array<object> |
The list of metric-based scaling policies. |
|
|
object |
The metric data. |
||
| MetricTargetAverageUtilization |
integer |
The target value of the metric.
|
20 |
| MetricType |
string |
The metric that triggers the scaling policy. Valid values:
|
CPU |
| SlbProject |
string |
The SLB access log project. |
test |
| SlbLogstore |
string |
The Logstore for SLB access logs. |
test |
| Vport |
string |
The SLB port. |
80 |
| SlbId |
string |
The SLB instance ID. |
lb-xxx |
| MaxReplicas |
integer |
The maximum number of instances. |
3 |
| MinReplicas |
integer |
The minimum number of instances. |
1 |
| ScaleRuleName |
string |
The name of the scaling policy. |
test |
| EnableIdle |
boolean |
||
| Message |
string |
The returned message. Valid values:
|
success |
| ErrorCode |
string |
The error code. The following rules apply:
|
空 |
| Code |
string |
The HTTP status code or the POP error code. Valid values:
|
200 |
| Success |
boolean |
Indicates whether the application instance was successfully restarted. Valid values:
|
true |
Examples
Success response
JSON format
{
"RequestId": "91F93257-7A4A-4BD3-9A7E-2F6EAE6D****",
"TraceId": "0a98a02315955564772843261e****",
"Data": {
"Timer": {
"EndDate": "2021-04-25",
"BeginDate": "2021-03-25",
"Schedules": [
{
"AtTime": "08:00",
"TargetReplicas": 3,
"MinReplicas": 1,
"MaxReplicas": 10
}
],
"Period": "* * *"
},
"UpdateTime": 1616642248938,
"AppId": "7171a6ca-d1cd-4928-8642-7d5cfe69****",
"CreateTime": 1616642248938,
"LastDisableTime": 1641882854484,
"ScaleRuleEnabled": true,
"ScaleRuleType": "timing",
"Metric": {
"Metrics": [
{
"MetricTargetAverageUtilization": 20,
"MetricType": "CPU",
"SlbProject": "test",
"SlbLogstore": "test",
"Vport": "80",
"SlbId": "lb-xxx"
}
],
"MaxReplicas": 3,
"MinReplicas": 1
},
"ScaleRuleName": "test",
"EnableIdle": false
},
"Message": "success",
"ErrorCode": "空",
"Code": "200",
"Success": true
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidScalingRuleDate.BeginAfterEnd | The specified beginning time is later than the ending time. | The specified begin date is later than the end date. |
| 400 | InvalidScalingRuleDate.Format | The specified date is invalid. | The specified date is invalid. The correct format is yyyy-MM-dd . |
| 400 | InvalidScalingRuleName.NotFound | The specified ScalingRuleName does not exist. | The specified ScalingRuleName does not exist. |
| 400 | InvalidScalingRuleTime.Conflict | The specified scaling rule time is invalid. Another schedule has been set for the specified time range. Please set a different time. | The specified scaling rule time is invalid. Another schedule has been set for the specified time range. Please set a different time. |
| 400 | InvalidScalingRuleTime.Format | The specified time is invalid. | The specified time is invalid. The correct format is HH:mm . |
| 400 | QuotaExceeded.ScalingRuleTime | The maximum number of scaling policy trigger time is exceeded. | Scaling rule time quota exceeded. |
| 400 | NoComputeResourceQuota.Exceed | Your compute resource is insufficient. Please contact us to raise the quota. | |
| 400 | NoComputeResourceQuota.App.Exceed | You can create %s instances for each application. Please submit a ticket to raise the quota. | You can create %s instances for each application. please join the DingTalk group 32874633 for technical support. |
| 400 | NoComputeResourceQuota.User.Exceed | Your account is limited to create %s instances. Please submit a ticket to raise the quota. | Your account is limited to create %s instances. please join the DingTalk group 32874633 for technical support. |
| 400 | System.Upgrading | The system is being upgraded. Please try again later. | |
| 400 | MinReadyInstances.Not.Smaller.Replicas | The minimum number of available instances must be less than the number of application instances. | The minimum number of available instances must be less than the number of application instances. |
| 400 | MinReadyInstanceRatio.Invalid | The ratio of minimum available instances must be between 0 and 100. | |
| 400 | Application.ChangerOrderRunning | An application change process is in progress. Please try again later. | An application change process is in progress. Please try again later. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.