Queries an auto scaling policy of an application.
Debugging
Request headers
This operation uses only common request headers and does not have operation-specific request headers. For more information, see Common request and response headers.
Request syntax
GET /pop/v1/sam/scale/applicationScalingRule HTTP/1.1
Request parameters
Parameter |
Type |
Position |
Required |
Example |
Description |
AppId | String | Query | Yes | a0d2e04c-159d-40a8-b240-d2f2c263**** | The application ID. |
ScalingRuleName | String | Query | Yes | test | The name of the auto scaling policy. |
Response parameters
Parameter |
Type |
Example |
Description |
RequestId | String | 73404D3D-EE4F-4CB2-B197-5C46F6A1**** | The request ID. |
TraceId | String | 0b57ff7e16243300839193068e**** | The trace ID that is used to query the details of the request. |
Data | Object | The returned result. |
|
Timer | Object | The details of the scheduled auto scaling policy. |
|
EndDate | String | 2021-04-25 | The end date of the validity period of the scheduled auto scaling policy. Valid values:
|
BeginDate | String | 2021-03-25 | The start date of the validity period of the scheduled auto scaling policy. Valid values:
|
Schedules | Array of Schedule | The points in time at which the auto scaling policy is triggered within one day. |
|
AtTime | String | 08:00 | The point in time. Format: Hour:Minute. |
TargetReplicas | Integer | 2 | The expected number of instances. |
MinReplicas | Integer | 1 | The minimum number of instances. |
MaxReplicas | Integer | 10 | The maximum number of instances. |
Period | String | * * * | The frequency at which the scheduled auto scaling policy is executed. Valid values:
|
UpdateTime | Long | 1624330075827 | The time when the auto scaling policy was updated. Unit: milliseconds. |
AppId | String | a0d2e04c-159d-40a8-b240-d2f2c263**** | The application ID. |
CreateTime | Long | 1624329843790 | The time when the auto scaling policy was created. Unit: milliseconds. |
LastDisableTime | Long | 1641882854484 | The time when the auto scaling policy was last disabled. |
ScaleRuleEnabled | Boolean | true | Indicates whether the auto scaling policy is enabled. Valid values:
|
ScaleRuleType | String | timing | The type of the auto scaling policy. Valid values:
|
Metric | Object | The details of the metric-based auto scaling policy. |
|
Metrics | Array of Metric | The metrics that are used to trigger the auto scaling policy. |
|
MetricTargetAverageUtilization | Integer | 20 | The limit on the metric.
|
MetricType | String | CPU | The metric that is used to trigger the auto scaling policy. Valid values:
|
SlbProject | String | test | The project that stores the SLB access logs. |
SlbLogstore | String | test | The Logstore that stores the SLB access logs. |
Vport | String | 80 | The port number of the SLB instance. |
SlbId | String | lb-xxx | The ID of the SLB instance. |
MetricsStatus | Object | The execution status of the metric-based auto scaling policy. |
|
DesiredReplicas | Long | 2 | The expected number of instances. |
NextScaleTimePeriod | Integer | 3 | The duration for which the metric-based auto scaling policy takes effect next time. |
CurrentReplicas | Long | 2 | The current number of instances. |
LastScaleTime | String | 2022-01-11T08:14:32Z | The time when the auto scaling policy was last triggered. |
CurrentMetrics | Array of CurrentMetric | The metrics that are used to trigger the current auto scaling policy. |
|
Type | String | Resource | The type of the data. This parameter corresponds to the metric.
|
CurrentValue | Long | 0 | The current value of the metric. |
Name | String | cpu | The name of the metric.
|
NextScaleMetrics | Array of NextScaleMetric | The metrics that are used to trigger the auto scaling policy next time. |
|
NextScaleOutAverageUtilization | Integer | 21 | The metric value as a percentage that triggers the application scale-out next time. |
NextScaleInAverageUtilization | Integer | 10 | The metric value as a percentage that triggers the application scale-in next time. |
Name | String | cpu | The name of the metric.
|
MaxReplicas | Integer | 3 | The maximum number of instances. |
MinReplicas | Integer | 1 | The minimum number of instances. |
ScaleUpRules | Object | The scale-out rule. |
|
Step | Long | 100 | The step size for the scale-out. This parameter indicates the maximum number of instances that can be added per unit time. |
StabilizationWindowSeconds | Long | 300 | The cooldown time of the scale-out. Valid values: 0 to 3600. Unit: seconds. Default value: 0. |
Disabled | Boolean | false | Indicates whether the application scale-in is disabled. Valid values:
Note If this parameter is set to true, the application instances are never reduced. This prevents business risks during peak hours. By default, this parameter is set to false. |
ScaleDownRules | Object | The scale-in rule. |
|
Step | Long | 100 | The step size for the scale-in. This parameter indicates the maximum number of instances that can be removed per unit time. |
StabilizationWindowSeconds | Long | 300 | The cooldown time of the scale-in. Valid values: 0 to 3600. Unit: seconds. Default value: 0. |
Disabled | Boolean | false | Indicates whether the application scale-in is disabled. Valid values:
Note If this parameter is set to true, the application instances are never reduced. This prevents business risks during peak hours. By default, this parameter is set to false. |
ScaleRuleName | String | test | The name of the auto scaling policy. |
MinReadyInstances | Integer | 1 | The minimum number of available instances. Valid values:
Note To ensure business continuity, make sure that at least one instance is available during application deployment and rollback. |
MinReadyInstanceRatio | Integer | -1 | The ratio of the minimum number of available instances to the current number of instances. Valid values:
Note If the MinReadyInstance and MinReadyInstanceRatio parameters are configured and the MinReadyInstanceRatio parameter is set to a number from 0 to 100, the value of the MinReadyInstanceRatio parameter takes precedence. For example, if the MinReadyInstances parameter is set to 5, and the MinReadyInstanceRatio parameter is set to 50, the minimum number of available instances is set to the nearest integer rounded up from the calculated result of the following formula: Current number of instances × Value of MinReadyInstanceRatio. |
Message | String | success | The returned message. Valid values:
|
ErrorCode | String | Null | The error code. Valid values:
|
Code | String | 200 | The HTTP status code. Valid values:
|
Success | Boolean | true | Indicates whether the application instances were restarted. Valid values:
|
Examples
Sample requests
GET /pop/v1/sam/scale/applicationScalingRule?AppId=a0d2e04c-159d-40a8-b240-d2f2c263****&ScalingRuleName=test HTTP/1.1
Host:sae.aliyuncs.com
Content-Type:application/json
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeApplicationScalingRuleResponse>
<RequestId>73404D3D-EE4F-4CB2-B197-5C46F6A1****</RequestId>
<TraceId>0b57ff7e16243300839193068e****</TraceId>
<Data>
<Timer>
<EndDate>2021-04-25</EndDate>
<BeginDate>2021-03-25</BeginDate>
<Schedules>
<AtTime>08:00</AtTime>
<TargetReplicas>2</TargetReplicas>
<MinReplicas>1</MinReplicas>
<MaxReplicas>10</MaxReplicas>
</Schedules>
<Period>* * *</Period>
</Timer>
<UpdateTime>1624330075827</UpdateTime>
<AppId>a0d2e04c-159d-40a8-b240-d2f2c263****</AppId>
<CreateTime>1624329843790</CreateTime>
<LastDisableTime>1641882854484</LastDisableTime>
<ScaleRuleEnabled>true</ScaleRuleEnabled>
<ScaleRuleType>timing</ScaleRuleType>
<Metric>
<Metrics>
<MetricTargetAverageUtilization>20</MetricTargetAverageUtilization>
<MetricType>CPU</MetricType>
<SlbProject>test</SlbProject>
<SlbLogstore>test</SlbLogstore>
<Vport>80</Vport>
<SlbId>lb-xxx</SlbId>
</Metrics>
<MetricsStatus>
<DesiredReplicas>2</DesiredReplicas>
<NextScaleTimePeriod>3</NextScaleTimePeriod>
<CurrentReplicas>2</CurrentReplicas>
<LastScaleTime>2022-01-11T08:14:32Z</LastScaleTime>
<CurrentMetrics>
<Type>Resource</Type>
<CurrentValue>0</CurrentValue>
<Name>cpu</Name>
</CurrentMetrics>
<NextScaleMetrics>
<NextScaleOutAverageUtilization>21</NextScaleOutAverageUtilization>
<NextScaleInAverageUtilization>10</NextScaleInAverageUtilization>
<Name>cpu</Name>
</NextScaleMetrics>
</MetricsStatus>
<MaxReplicas>3</MaxReplicas>
<MinReplicas>1</MinReplicas>
<ScaleUpRules>
<Step>100</Step>
<StabilizationWindowSeconds>300</StabilizationWindowSeconds>
<Disabled>false</Disabled>
</ScaleUpRules>
<ScaleDownRules>
<Step>100</Step>
<StabilizationWindowSeconds>300</StabilizationWindowSeconds>
<Disabled>false</Disabled>
</ScaleDownRules>
</Metric>
<ScaleRuleName>test</ScaleRuleName>
<MinReadyInstances>1</MinReadyInstances>
<MinReadyInstanceRatio>-1</MinReadyInstanceRatio>
</Data>
<Message>success</Message>
<Code>200</Code>
<Success>true</Success>
</DescribeApplicationScalingRuleResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "73404D3D-EE4F-4CB2-B197-5C46F6A1****",
"TraceId" : "0b57ff7e16243300839193068e****",
"Data" : {
"Timer" : {
"EndDate" : "2021-04-25",
"BeginDate" : "2021-03-25",
"Schedules" : [ {
"AtTime" : "08:00",
"TargetReplicas" : 2,
"MinReplicas" : 1,
"MaxReplicas" : 10
} ],
"Period" : "* * *"
},
"UpdateTime" : 1624330075827,
"AppId" : "a0d2e04c-159d-40a8-b240-d2f2c263****",
"CreateTime" : 1624329843790,
"LastDisableTime" : 1641882854484,
"ScaleRuleEnabled" : true,
"ScaleRuleType" : "timing",
"Metric" : {
"Metrics" : [ {
"MetricTargetAverageUtilization" : 20,
"MetricType" : "CPU",
"SlbProject" : "test",
"SlbLogstore" : "test",
"Vport" : "80",
"SlbId" : "lb-xxx"
} ],
"MetricsStatus" : {
"DesiredReplicas" : 2,
"NextScaleTimePeriod" : 3,
"CurrentReplicas" : 2,
"LastScaleTime" : "2022-01-11T08:14:32Z",
"CurrentMetrics" : [ {
"Type" : "Resource",
"CurrentValue" : 0,
"Name" : "cpu"
} ],
"NextScaleMetrics" : [ {
"NextScaleOutAverageUtilization" : 21,
"NextScaleInAverageUtilization" : 10,
"Name" : "cpu"
} ]
},
"MaxReplicas" : 3,
"MinReplicas" : 1,
"ScaleUpRules" : {
"Step" : 100,
"StabilizationWindowSeconds" : 300,
"Disabled" : false
},
"ScaleDownRules" : {
"Step" : 100,
"StabilizationWindowSeconds" : 300,
"Disabled" : false
}
},
"ScaleRuleName" : "test",
"MinReadyInstances" : 1,
"MinReadyInstanceRatio" : -1
},
"Message" : "success",
"Code" : "200",
"Success" : true
}
Error codes
For a list of error codes, see Service error codes.