Scales an application.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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

PUT /pop/v1/sam/app/rescaleApplication HTTP/1.1

Request parameters

ParameterTypePositionRequiredExampleDescription
AppIdStringQueryYes0099b7be-5f5b-4512-a7fc-56049ef1****

The application ID.

ReplicasIntegerQueryYes5

The expected number of instances.

MinReadyInstancesIntegerQueryNo1

The minimum number of available instances. Valid values:

  • If you set the value to 0, business interruptions occur when the application is upgraded.
  • If you set the value to -1, the minimum number of available instances is automatically set to a system-recommended value. The value is the nearest integer to which the calculated result of the following formula is rounded up: Current number of instances × 25%. For example, if five instances are available, the minimum number of available instances is calculated by using the following formula: 5 × 25% = 1.25. In this case, the minimum number of available instances is 2.
Note To ensure business continuity, make sure that at least one instance is available during application deployment and rollback.
MinReadyInstanceRatioIntegerQueryNo-1

The ratio of the minimum number of available instances to the current number of instances. Valid values:

  • If you set the value to -1, the minimum number of available instances is not determined based on this parameter. This is the default value.
  • If you set the value to a number from 0 to 100, the minimum number of available instances is calculated by using the following formula: Current number of instances × (Value of MinReadyInstanceRatio × 100%). If the calculated result is not an integer, the result is rounded up to the nearest integer. For example, if five instances are available and the MinReadyInstanceRatio parameter is set to 50, the minimum number of available instances is 3.
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 × 50%.
AutoEnableApplicationScalingRuleBooleanQueryNotrue

Specifies whether to automatically enable an auto scaling policy for the application. Valid values:

  • true
  • false

Response parameters

ParameterTypeExampleDescription
MessageStringsuccess

The returned message.

RequestIdString91F93257-7A4A-4BD3-9A7E-2F6EAE6D****

The request ID.

DataObject

The returned result.

ChangeOrderIdString0e09829f-4914-4612-bc88-6f52fd81****

The ID of the change order.

ErrorCodeStringNull

The error code. Valid values:

  • If the call is successful, the ErrorCode parameter is not returned.
  • If the call fails, the ErrorCode parameter is returned. For more information, see the "Error codes" section in this topic.
CodeString200

The HTTP status code. Valid values:

  • 2xx: The call was successful.
  • 3xx: The call was redirected.
  • 4xx: The call failed.
  • 5xx: A server error occurred.
SuccessBooleantrue

Indicates whether the application was scaled. Valid values:

  • true: The application was scaled.
  • false: The application failed to be scaled.

Examples

Sample requests

PUT /pop/v1/sam/app/rescaleApplication?AppId=0099b7be-5f5b-4512-a7fc-56049ef1****&Replicas=5&MinReadyInstances=1&MinReadyInstanceRatio=-1&AutoEnableApplicationScalingRule=true 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

<RescaleApplicationResponse>
    <Message>success</Message>
    <RequestId>91F93257-7A4A-4BD3-9A7E-2F6EAE6D****</RequestId>
    <Data>
        <ChangeOrderId>0e09829f-4914-4612-bc88-6f52fd81****</ChangeOrderId>
    </Data>
    <Code>200</Code>
    <Success>true</Success>
</RescaleApplicationResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Message" : "success",
  "RequestId" : "91F93257-7A4A-4BD3-9A7E-2F6EAE6D****",
  "Data" : {
    "ChangeOrderId" : "0e09829f-4914-4612-bc88-6f52fd81****"
  },
  "Code" : "200",
  "Success" : true
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidApplication.NotFoundThe current application does not exist.The specified application is not found.
400InvalidParameter.NotEmptyYou must specify the parameter %s.The value of the %s parameter is invalid. This parameter cannot be left empty.
400InvalidParameter.ObviouslyThe specified parameter is invalid {%s}.The value of the {%s} parameter is invalid.
400InvalidParameter.WithMessageThe parameter is invalid {%s}: %sThe value %s of the {%s} parameter is invalid.
400user.indebtThe user has an outstanding payment.The current user has overdue payments.
400NoComputeResourceQuota.App.ExceedYou can create %s instances for each application. Please submit a ticket to raise the quota.A maximum of %s instances can be created for each application. Join the DingTalk group 32874633 for technical support.
400NoComputeResourceQuota.User.ExceedYour account is limited to create %s instances. Please submit a ticket to raise the quota.A maximum of %s instances can be created within your account. Join the DingTalk group 32874633 for technical support.
400System.UpgradingThe system is being upgraded. Please try again later.The system is being upgraded. Try again later.
400Application.ChangerOrderRunningAn application change process is in progress. Please try again later.An application change is in progress. Try again later.
400Application.InvalidStatusThe application status is abnormal. Please try again later.The application is in an abnormal state. Try again later.
400Application.NotDeployYetThe application has not been deployed. Please deploy it and try again.The application is not deployed. Deploy the application and try again.
400MinReadyInstances.Not.Smaller.ReplicasThe minimum number of available instances must be less than the number of application instances.The minimum number of available instances is larger than or equal to the total number of instances.
400MinReadyInstanceRatio.InvalidThe ratio of minimum available instances must be between 0 and 100.The value of the MinReadyInstanceRatio parameter is invalid. The parameter value must be an integer from 0 to 100.
404Associate.Eip.Not.EnoughNo sufficient EIPs are available.No EIP is available to be associated with the application. Purchase EIPs.

For a list of error codes, see Service error codes.