CreateApplicationScalingRule_Serverless 应用引擎_API文档

插件下载了解更多
VS Code 插件
安装插件之前,确保已安装 VS Code安装插件之前,确保已安装 VS Code
Alibaba Cloud Developer Toolkit is a collection of extensions that can help access Alibaba Cloud services in Visual Studio Code.
JetBrains 插件
安装插件之前,确保已安装 JetBrains IDE安装插件之前,确保已安装 JetBrains IDE
The Alibaba Cloud Developer Toolkit for JetBrains makes it easier to access Alibaba Cloud services.

接口说明

使用须知

  • 您最多可以为 1 个应用创建 5 条弹性策略。
  • 您最多可以为 1 条定时弹性策略,创建 20 条单天内触发时间点。
  • 弹性策略启用时,请勿手动执行应用生命周期管理操作,例如应用扩缩容、部署应用、更改规格、重启应用或停止应用。如果您需要对应用执行该类操作,请停用弹性策略后,再手动执行操作。
  • 如果当前应用处于扩容、缩容、部署(单批、分批或灰度)、更改规格、重启或停止等过程中,该应用暂时无法添加或者启动弹性策略。
  • 如果单个应用需要弹出超过 50 个实例,请联系 SAE 技术支持并申请白名单。更多信息,请参见联系我们

流控信息

当前云产品API请求速率暂未透出。

授权信息

如下是此API对应的授权信息,用于RAM权限策略语句的Action元素中,为RAM用户或RAM角色授予调用此API的权限。请通过 RAM 访问控制设置,使用方法可参考访问控制帮助文档

具体说明如下:展开详情

操作访问级别资源类型条件关键字关联操作
sae:CreateApplicationScalingRule
Create
全部资源
*

请求语法

POST /pop/v1/sam/scale/applicationScalingRule HTTP/1.1

请求参数

字段名称字段详情
AppIdstring

应用 ID。

示例值:7171a6ca-d1cd-4928-8642-7d5cfe69****
ScalingRuleNamestring

自定义的弹性伸缩策略名。应用内,策略名称不可重复,必须以小写字母开头,仅可包含小写字母、数字及短划线(-),不超过 32 个字符。展开详情

示例值:timer-0800-2100
ScalingRuleTypestring

弹性伸缩策略类型。取值说明如下:展开详情

示例值:timing
ScalingRuleTimerstring

定时弹性策略的配置。当您选择定时弹性策略或使用 SDK 设置时,该参数必选。展开详情

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

监控指标弹性策略的配置。当您选择监控指标弹性策略设置时,该参数必选。展开详情

示例值:{"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}}
MinReadyInstancesinteger<int32>

最小存活实例数。取值说明如下:展开详情

示例值:3
MinReadyInstanceRatiointeger<int32>

最小存活实例数百分比。取值说明如下:展开详情

示例值:-1
ScalingRuleEnableboolean

是否启用弹性伸缩策略。取值说明如下:展开详情

示例值:true
EnableIdleboolean

返回参数

字段名称字段详情
RequestIdstring

请求 ID。

示例值:91F93257-7A4A-4BD3-9A7E-2F6EAE6D****
TraceIdstring

调用链 ID,用于精确查询调用信息。

示例值:0a98a02315955564772843261e****
Dataobject

返回结果。

Messagestring

附加信息。取值说明如下:展开详情

示例值:success
ErrorCodestring

错误码。取值说明如下:展开详情

示例值:
Codestring

接口状态或 POP 错误码。取值说明如下:展开详情

示例值:200
Successboolean

重启应用实例是否成功。取值说明如下:展开详情

示例值:true

返回示例

错误码

全局错误码
HTTP 状态码错误码错误信息操作
400
InstanceExist.ScalingRuleName
The specified ScalingRuleName already exists.诊断
400
InvalidScalingRuleDate.BeginAfterEnd
The specified beginning time is later than the ending time.诊断
400
InvalidScalingRuleDate.Format
The specified date is invalid.诊断
400
InvalidScalingRuleName.NotFound
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.诊断
400
InvalidScalingRuleTime.Format
The specified time is invalid.诊断
400
QuotaExceeded.ScalingRule
The maximum number of application scaling rules is exceeded.诊断
400
QuotaExceeded.ScalingRuleTime
The maximum number of scaling policy trigger time is exceeded.诊断
400
NoComputeResourceQuota.App.Exceed
You can create %s instances for each application. Please submit a ticket to raise the quota.诊断
400
NoComputeResourceQuota.Exceed
Your compute resource is insufficient. Please contact us to raise the quota.诊断
400
NoComputeResourceQuota.User.Exceed
Your account is limited to create %s instances. Please submit a ticket to raise the quota.诊断
400
System.Upgrading
The system is being upgraded. Please try again later.诊断
400
OperationDenied.SDKNotSupported
Metrics is not supported in SDK诊断
400
MinReadyInstances.Not.Smaller.Replicas
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.诊断

变更历史

变更时间变更内容概要操作
2024-08-30
新增请求参数EnableIdle
变更返回参数
2023-05-24
变更返回参数
2023-05-23
变更返回参数
2022-12-26
变更错误码400
2022-12-19
变更返回参数

相关示例