ServerMania logo

Create Autoscaling Rule for VS

To create autoscaling rule for a virtual server, use the following request:

POST /virtual_machines/:virtual_machine_id/auto_scaling.xml
POST /virtual_machines/:virtual_machine_id/auto_scaling.json

XML Request Example

curl -i -X POST -u user:password http://test/virtual_machines/12/auto_scaling.xml -H 'Accept: application/xml' -H 'Content-type: application/xml' -d '<auto_scaling_configurations><up><cpu><enabled>1</enabled><for_minutes>5</for_minutes><limit_trigger>40</limit_trigger><adjust_units>20</adjust_units><up_to>100</up_to></cpu><memory><enabled>1</enabled><for_minutes>5</for_minutes><limit_trigger>90</limit_trigger><adjust_units>128</adjust_units><up_to>1024</up_to></memory><disk><enabled>1</enabled><for_minutes>5</for_minutes><limit_trigger>80</limit_trigger><adjust_units>10</adjust_units><up_to>20</up_to></disk></up><down><cpu><enabled>1</enabled><for_minutes>5</for_minutes><limit_trigger>100</limit_trigger><adjust_units>10</adjust_units></cpu><memory><enabled>1</enabled><for_minutes>5</for_minutes><limit_trigger>100</limit_trigger><adjust_units>128</adjust_units></memory><disk><enabled>1</enabled><for_minutes>5</for_minutes><limit_trigger>80</limit_trigger><adjust_units>10</adjust_units></disk></down></auto_scaling_configurations>'

JSON Request Example

curl -i -X POST -u user:password http://test/virtual_machines/12/auto_scaling.json -H 'Accept: application/json' -H 'Content-type: application/json' -d '{ "auto_scaling_configurations":{"up":{"cpu":{"enabled":"1", "for_minutes":"5", "limit_trigger":"40", "adjust_units":"20", "up_to":"100"},"memory":{"enabled":"1", "for_minutes":"5", "limit_trigger":"90", "adjust_units":"128", "up_to":"1024"},"disk":{"enabled":"1", "for_minutes":"5", "limit_trigger":"80", "adjust_units":"10", "up_to":"20"}},"down":{"cpu":{"enabled":"1", "for_minutes":"5", "limit_trigger":"40", "adjust_units":"20"},"memory":{"enabled":"1", "for_minutes":"5", "limit_trigger":"90", "adjust_units":"128", "up_to":"1024"},"disk":{"enabled":"1", "for_minutes":"5", "limit_trigger":"80", "adjust_units":"10"}}}}'

Where:

up_to* - the amount of resource which cannot be exceeded within 24 hours period; only for autoscale up rules

for_minutes* - the time threshold before scaling will be triggered

trigger_limit* - the amount of the resource usage (%). If this value is reached by the VS for the period specified by the for_minutes parameter, the system will add/remove the amount of units set by the adjust_units parameters.

adjust_units* - the amount of resource units which the system should add/remove if the rule is met

enabled* - set 1 to enable, or 0 to disable

cpu/memory/disk - indicate type of resource for which the autoscaling rule is set (Disk usage autoscaling is applicable for VS primary disk only)