Update an Auto Scaling Policy
/paas/api/v1.1/instancemgmt/{identityDomainId}/services/APAAS/instances/{appName}/autoscaling/policies
At least one rule (operation) must be defined to enable auto scaling for a service instance. If you update both rules (operations), make sure the conditions do not conflict each other.
Request
- application/json
-
appName: string
Name of the application.
-
identityDomainId: string
Identity domain ID for the Oracle Application Container Cloud Service account.
-
X-ID-TENANT-NAME: string
Identity domain ID for the Oracle Application Container Cloud Service account.
object
-
description(optional):
string
Description of the auto scaling policy.
-
name(optional):
string
Name of the auto scaling policy. If no name is specified, the default name is the service instance name.
-
policies:
array policies
Groups details about the auto scaling policy.
object
-
alarm:
object alarm
Groups the conditions for a rule to trigger an alarm.
-
coolDownPeriod:
integer
The number of minutes after a scaling activity is completed before any further scaling activities can start. A valid value is a positive integer in the range of 30 to 300.
If the alarm is still active after the cool down period, the scaling activity is repeated. The process continues until the alarm is no longer active, or the maximum or minimum cluster size is reached.
-
maxClusterSize:
integer
Maximum cluster size supported by the service instance. Required and valid only for a
ScaleOut
rule. -
minClusterSize:
integer
Minimum cluster size supported by the service instance. Required and valid only for a
ScaleIn
rule. -
operation:
string
The scaling operation to perform when the alarm is triggered. At least one scaling operation must be defined in the policy. Only scale out and scale in are supported at this time. Valid values:
scaleOut
,scaleIn
,scaleUp
, andscaleDown
.
object
-
breachedOnInstance:
string
Whether auto scaling is to be performed when an alarm rule is breached on all VM instances or on any of the VM instances. Valid values:
ALL
,ANY
-
comparisonOperator:
string
The arithmetic operation to use when comparing the specified
statistic
andthreshold
values. Valid values:GreaterThanOrEqualToThreshold
(for scale out),LessThanOrEqualToThreshold
(for scale in) -
metricName:
string
Name of the metric set in the alarm. Supported values are:
MemoryUtilization
- The unit of measurement ispercent
.Memory
- The unit of measurement isMB
.
If you are defining both the scale out and scale in operations in a policy, the same metric must be specified for each operation.
-
metricUnit:
string
Unit of measurement for the alarm's associated metric. Valid values:
percent
,GB
-
sampleCount:
integer
The consecutive number of times data is compared for the given metric. A valid value is a positive integer in the range of 1 to 24.
-
sampleFrequency:
integer
The interval in minutes when data is compared for the given metric. A valid value is a positive integer in the range of 5 to 60.
-
statistic:
string
The statistic to apply to the alarm's associated metric. Valid values:
AVG
,MIN
,MAX
-
threshold:
number
The value against which the given
statistic
is compared. A valid value can be a positive integer or float, in the range of 1 to 100 (for apercent
value), and between 1 to 240 (for aGB
value).
Response
- application/json
202 Response
object
-
description(optional):
string
Description of the auto scaling policy.
-
message(optional):
string
For example:
Rule is Active
-
name(optional):
string
Name of the auto scaling policy. The default name is the service instance name.
-
policies(optional):
array policies
Groups details about the auto scaling policy.
-
startTime(optional):
string
Date and time the auto scaling policy was created or updated.
-
status(optional):
string
State of the auto scaling policy.
-
version(optional):
string
Version of the auto scaling policy.
object
-
alarm(optional):
object alarm
Groups the conditions for a rule to trigger an alarm.
-
coolDownPeriod(optional):
integer
The number of minutes after a scaling activity is completed before any further scaling activities can start.
-
maxClusterSize(optional):
integer
Maximum cluster size supported by the service instance when scaling out.
-
minClusterSize(optional):
integer
Minimum cluster size supported by the service instance when scaling in.
-
operation(optional):
string
The scaling operation to perform when the alarm is triggered. For example:
scaleOut
,scaleIn
object
-
breachedOnInstance(optional):
string
Whether auto scaling is to be performed when an alarm rule is breached on all VM instances or on any of the VM instances. For example:
ALL
,ANY
-
comparisonOperator(optional):
string
Arithmetic operation to use when comparing the specified
statistic
andthreshold
values. For example:GreaterThanOrEqualToThreshold
,LessThanOrEqualToThreshold
-
metricName(optional):
string
Name of the metric set in the alarm. For example:
CPUUtilization
-
metricUnit(optional):
string
Unit of measurement for the alarm's associated metric. For example:
percent
-
sampleCount(optional):
integer
The consecutive number of times data is compared for the given metric.
-
sampleFrequency(optional):
integer
The interval in minutes when data is compared for the given metric.
-
statistic(optional):
string
The statistic to apply to the alarm's associated metric. For example:
AVG
,MIN
,MAX
-
threshold(optional):
number
The value against which the given
statistic
is compared.
400 Response
object
-
errors(optional):
array errors
Groups the error details.
-
status(optional):
string
Description of the operation status. For example:
Bad Request
object
-
detail(optional):
string
Error detail.
-
source(optional):
string
Name of the alarm attribute that is causing the error. For example:
threshold
Examples
The following example shows how to update the auto scaling policy for an Oracle Application Container Cloud Service application instance, by submitting a PUT request on the REST resource using cURL.
Note:
-
The command in this example uses the URL structure
https://rest_server_url/resource-path
, whererest_server_url
is the REST server to contact for your identity domain (or Cloud Account). See Send Requests. -
In the resource path, the service type
../APAAS/..
is case-sensitive.
cURL Command
curl -i -X PUT -u username:userPassword1! -d @updatepolicy.json -H "Content-Type:application/json" -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/api/v1.1/instancemgmt/ExampleIdentityDomain/services/APAAS/instances/ExampleInstance/autoscaling/policies
Example of Request Body
The following example shows the contents of the request body in JSON format.
{
"name": "Policy",
"description": "Auto Scaling Policy",
"policies": [
{
"operation": "scaleOut",
"alarm": {
"metricName": "MemoryUtilization",
"metricUnit": "percent",
"statistic": "AVG",
"comparisonOperator": "GreaterThanOrEqualToThreshold",
"threshold": 90,
"sampleCount": 3,
"sampleFrequency": 10,
"breachedOnInstance": "ALL"
},
"coolDownPeriod": 30,
"maxClusterSize": 4
},
{
"operation": "scaleIn",
"alarm": {
"metricName": "MemoryUtilization",
"metricUnit": "percent",
"statistic": "AVG",
"comparisonOperator": "LessThanOrEqualToThreshold",
"threshold": 40,
"sampleCount": 3,
"sampleFrequency": "10",
"breachedOnInstance": "ANY"
},
"coolDownPeriod": 30,
"minClusterSize": 2
}
]
}
Example of Response Header
The following shows an example of the response header.
HTTP/1.1 202 Accepted
Date: Thu, 19 May 2016 00:53:16 GMT
Content-Length: 0
Content-Type: application/json
Example of Response Body
The following shows an example of the response body.
{
"name": "Policy 2",
"description": "Auto Scaling Policy 2",
"policies": [
{
"operation": "scaleOut",
"alarm": {
"metricName": "Memory",
"metricUnit": "MB",
"statistic": "AVG",
"comparisonOperator": "GreaterThanOrEqualToThreshold",
"threshold": "90",
"sampleCount": "3",
"sampleFrequency": "10",
"breachedOnInstance": "ALL"
},
"coolDownPeriod": "30",
"maxClusterSize": "4"
},
{
"operation": "scaleIn",
"alarm": {
"metricName": "Memory",
"metricUnit": "MB",
"statistic": "AVG",
"comparisonOperator": "LessThanOrEqualToThreshold",
"threshold": "40",
"sampleCount": "3",
"sampleFrequency": "10",
"breachedOnInstance": "ANY"
},
"coolDownPeriod": "30",
"minClusterSize": "2"
}
],
"version": 2,
"status": "Active",
"startTime": "2016-05-19T07:39:03.576+0000"
}