All Products
Search
Document Center

Serverless App Engine:UpdateApplicationScalingRule

Last Updated:Apr 29, 2026

Updating the application auto-scaling policy

Operation description

Usage notes

To scale an application beyond 50 instances, contact SAE technical support to be added to the allowlist. For details, see Contact us.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

sae:UpdateApplicationScalingRule

update

*Application

acs:sae:{#regionId}:{#accountId}:application/{#namespaceid}/{#appid}

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 name of an auto scaling policy after it 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 and endDate: The start and end dates for the policy's effective period.
    • If both parameters are set to null, the policy is always active. This is the default.

    • If you set beginDate to 2021-03-25 and endDate to 2021-04-25, the policy is effective for one month.

  • period: The execution schedule for the policy. Valid values:
    • * * *: Executes the policy at a specified time every day.

    • * * Fri,Mon: Executes the policy at a specified time on specified days of the week. You can select multiple days. The time is in the UTC+8 time zone. Valid values:
      • Sun: Sunday

      • Mon: Monday

      • Tue: Tuesday

      • Wed: Wednesday

      • Thu: Thursday

      • Fri: Friday

      • Sat: Saturday

    • 1,2,3,28,31 * *: Executes the policy at a specified time on specified days of a month. The value ranges from 1 to 31. If a specified day does not exist in a given month (for example, the 31st), the policy skips it.

  • schedules: The trigger times and the corresponding target number of instances. You can specify up to 20 time points. This field includes the following parameters:
    • atTime: The trigger time. The format is HH:mm, for example, 08:00.

    • targetReplicas: The target number of application instances. The value ranges from 1 to 50.

      Note

      To ensure business continuity, we recommend that you set the minimum number of surviving instances for each rolling deployment to 1 or higher. If you set this parameter to 0, your application is interrupted during an upgrade.

{"beginDate":null,"endDate":null,"period":"* * *","schedules":[{"atTime":"08:00","targetReplicas":10},{"atTime":"20:00","targetReplicas":3}]}

ScalingRuleMetric

string

No

The configuration for the metric-based scaling policy. This parameter is required for metric-based scaling policies.

The parameter includes the following fields:

  • maxReplicas: The maximum number of application instances.

  • minReplicas: The minimum number of application instances.

  • metricType: The metric that triggers the policy. Valid values:
    • CPU: The CPU usage.

    • MEMORY: The memory usage.

    • QPS: The average QPS of a single instance of a Java application over a 1-minute period.

    • RT: The average RT of all service interfaces of a Java application over a 1-minute period.

    • tcpActiveConn: The average number of active TCP connections per instance over a 30-second period.

    • SLB_QPS: The average QPS of an internet-facing SLB, measured per instance over a 15-second period.

    • SLB_RT: The average RT of an internet-facing SLB over a 15-second period.

    • INTRANET_SLB_QPS: The average QPS of an internal-facing SLB, measured per instance over a 15-second period.

    • INTRANET_SLB_RT: The average RT of an internal-facing SLB over a 15-second period.

  • metricTargetAverageUtilization: The target value for the specified metricType.
    • Target CPU usage, in percent.

    • Target memory usage, in percent.

    • Target QPS.

    • Target RT, in milliseconds.

    • Average number of active TCP connections, in connections/second.

    • Target internet-facing SLB QPS.

    • Target internet-facing SLB RT, in milliseconds.

    • Target internal-facing SLB QPS.

    • Target internal-facing SLB RT, in milliseconds.

  • slbId: The SLB ID.

  • slbProject: The Simple Log Service project.

  • slbLogstore: The Simple Log Service Logstore.

  • vport: The listening port of the SLB. Both HTTP and HTTPS are supported.

  • scaleUpRules: The scale-out rules.

  • scaleDownRules: The scale-in rules.

  • step: The step size for a scale-out or scale-in action. It defines the maximum number of instances that can be added or removed at a time.

  • disabled: Specifies whether to disable scale-in. Disabling scale-in prevents the application from scaling in, which can mitigate risks during peak traffic.
    • true: Disables scale-in.

    • false: Enables scale-in. This is the default value.

  • stabilizationWindowSeconds: The cooldown time, in seconds, for a scaling action. The value must be an integer from 0 to 3,600. The default is 0.

Note

If you specify multiple metrics, a scale-out is triggered when any metric meets its target. The number of instances will not exceed maxReplicas. A scale-in is triggered only when all metrics are below their targets. The number of instances will not drop below minReplicas.

{"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 instances that must remain available during a rolling deployment. Valid values:

  • If you set this parameter to 0, your application experiences service interruptions during a rolling deployment.

  • If you set this parameter to -1, the system uses a recommended value, which is 25% of the current number of instances. For example, if you have 5 instances, the minimum number of surviving instances is 2 (5 × 25% = 1.25, rounded up).

Note

To ensure business continuity, we recommend that you set the minimum number of surviving instances for each rolling deployment to 1 or higher.

3

MinReadyInstanceRatio

integer

No

The minimum percentage of instances that must remain available during a rolling deployment. Valid values:

  • -1: An initial value that indicates that a percentage is not used.

  • 0 to 100: A percentage that is rounded up. For example, if you have 5 instances and set this parameter to 50, the minimum number of surviving instances is 3.

Note

If you specify both MinReadyInstances and MinReadyInstanceRatio, and MinReadyInstanceRatio is not -1, MinReadyInstanceRatio takes precedence. For example, if MinReadyInstances is set to 5 and MinReadyInstanceRatio is set to 50, the system uses 50% to calculate the minimum number of surviving instances.

-1

EnableIdle

boolean

No

Specifies whether to enable or disable the idle mode.

Response elements

Element

Type

Description

Example

object

The returned information.

RequestId

string

The request ID.

91F93257-7A4A-4BD3-9A7E-2F6EAE6D****

TraceId

string

The trace ID used to query call details.

0a98a02315955564772843261e****

Data

object

The response data.

Timer

object

The configuration for scheduled scaling.

EndDate

string

The end date of the short-term scheduled scaling policy.

  • If BeginDate and EndDate are both set to null, the policy is long-term by default.

  • If you specify a date range, for example, BeginDate is set to 2021-03-25 and EndDate is set to 2021-04-25, the policy is effective for one month.

2021-04-25

BeginDate

string

The start date of the short-term scheduled scaling policy.

  • If BeginDate and EndDate are both set to null, the policy is long-term by default.

  • If you specify a date range, for example, BeginDate is set to 2021-03-25 and EndDate is set to 2021-04-25, the policy is effective for one month.

2021-03-25

Schedules

array<object>

The schedules for the scaling policy.

object

The configuration for a specific trigger schedule.

AtTime

string

The time at which the scaling action is triggered. Format: HH:mm.

08:00

TargetReplicas

integer

The target number of instances.

3

MinReplicas

integer

The minimum number of instances.

1

MaxReplicas

integer

The maximum number of instances.

10

Period

string

The recurrence schedule for the scaling policy.

  • * * *: The policy runs at a specified time every day.

  • * * Fri,Mon: The policy runs at a specified time on specific days of a week. You can select multiple days. The time is in the GMT+8 time zone. Valid values:

    • Sun: Sunday

    • Mon: Monday

    • Tue: Tuesday

    • Wed: Wednesday

    • Thu: Thursday

    • Fri: Friday

    • Sat: Saturday

  • 1,2,3,28,31 * *: The policy runs at a specified time on specific days of a month. You can select multiple days. If a month does not have a specific day, such as the 31st, the policy skips that day.

* * *

UpdateTime

integer

The time when the scaling policy was updated, in milliseconds.

1616642248938

AppId

string

The application ID.

7171a6ca-d1cd-4928-8642-7d5cfe69****

CreateTime

integer

The time when the scaling policy was created, in milliseconds.

1616642248938

LastDisableTime

integer

The time when the scaling policy was last disabled, in milliseconds.

1641882854484

ScaleRuleEnabled

boolean

Specifies whether the scaling policy is enabled. Valid values:

  • true: Enabled.

  • false: Disabled.

true

ScaleRuleType

string

The type of the scaling policy. Valid values:

  • timing: scheduled scaling

  • metric: metric-based scaling

  • mix: hybrid scaling

timing

Metric

object

The configuration for metric-based scaling.

Metrics

array<object>

The metrics that trigger scaling actions.

object

The configuration for a specific metric trigger.

MetricTargetAverageUtilization

integer

The target value for the specified metric. The unit varies based on the metric type.

  • Target CPU utilization, in percentage.

  • Target memory usage, in percentage.

  • Target queries per second (QPS).

  • Target response time, in milliseconds.

  • The target number of active TCP connections.

  • Target QPS for the public-facing SLB instance.

  • Target response time of the public-facing SLB instance, in milliseconds.

  • Target QPS for the internal SLB instance.

  • Target response time of the internal SLB instance, in milliseconds.

20

MetricType

string

The metric that triggers the scaling policy. Valid values:

  • CPU: CPU utilization.

  • MEMORY: memory usage.

  • QPS: The average queries per second (QPS) per instance over the last minute. This applies only to Java applications.

  • RT: The average response time (RT) of all service interfaces in the application over the last minute. This applies only to Java applications.

  • tcpActiveConn: The average number of active TCP connections per instance over the last 30 seconds.

  • SLB_QPS: The average QPS from the public-facing SLB, per instance, over the last 15 seconds.

  • SLB_RT: The average response time of a public-facing SLB instance over the last 15 seconds.

  • INTRANET_SLB_QPS: The average QPS from the internal SLB, per instance, over the last 15 seconds.

  • INTRANET_SLB_RT: The average response time of an internal SLB instance over the last 15 seconds.

CPU

SlbProject

string

The name of the Log Service Project for SLB access logs.

test

SlbLogstore

string

The name of 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

Specifies whether to enable idle mode.

Message

string

The response message.

  • success is returned if the request is successful.

  • An error message is returned if the request fails.

success

ErrorCode

string

The error code.

  • This parameter is returned only if the request fails.

  • For more information, see the Error codes section in this topic.

Code

string

The HTTP status code or a POP error code.

  • 2xx: The request was successful.

  • 3xx: The request was redirected.

  • 4xx: A client-side error occurred.

  • 5xx: A server-side error occurred.

200

Success

boolean

Specifies whether the request was successful. Valid values:

  • true: The request was successful.

  • false: The request failed.

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.