Skip to content

Create Auto Scaling Group

POST
/api/v1/scaler/scalegroups
curl --request POST \
--url 'https://api.e2enetworks.com/myaccount/api/v1/scaler/scalegroups?project_id=<PROJECT_ID>&apikey=<API_KEY>&location=<LOCATION>' \
--header 'Authorization: Bearer <API_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"plan_id": 1088,
"plan_name": "C3.8GB",
"slug_name": "e2e_public_cloud",
"sku_id": 12345,
"vm_image_id": 12345,
"vm_image_name": "Ubuntu-22.04",
"vm_template_id": 12345,
"my_account_sg_id": 12345,
"name": "web-autoscale-group",
"min_nodes": 2,
"desired": 2,
"max_nodes": 5,
"vpc": [
{
"name": "VPC-Example",
"network_id": 12345,
"ipv4_cidr": "10.8.46.0/23",
"state": "",
"subnets": [],
"is_e2e_vpc": true
}
],
"is_public_ip_required": true,
"isEncryptionEnabled": true,
"encryption_passphrase": "Secret@123",
"policy_type": "Default",
"policy": [
{
"type": "CHANGE",
"adjust": 1,
"parameter": "CPU",
"operator": ">",
"value": 60,
"period_number": 3,
"period": 10,
"cooldown": 150
},
{
"type": "CHANGE",
"adjust": -1,
"parameter": "CPU",
"operator": "<",
"value": 30,
"period_number": 3,
"period": 10,
"cooldown": 150
}
],
"scheduled_policy": [
{
"type": "CARDINALITY",
"adjust": 4,
"recurrence": "0 12 * * *"
},
{
"type": "CARDINALITY",
"adjust": 2,
"recurrence": "0 2 * * *"
}
]
}'

Provisions an auto scaling group (“scale group”). The group launches between min_nodes and max_nodes identical nodes from the selected image and plan, and scales the running count automatically according to its scaling policies.

At least one of policy (elastic) or scheduled_policy is required.

  • Elastic policy reacts to a metric (CPU, MEMORY, or a custom parameter). It is sent as two objects: a scale-up rule (adjust: 1) and a scale-down rule (adjust: -1).

  • Scheduled scheduled_policy changes the target node count on a cron schedule. It is sent as two objects (scale-up and scale-down), where scheduled_policy[0].adjust <= max_nodes, scheduled_policy[1].adjust >= min_nodes, and scheduled_policy[0].adjust >= scheduled_policy[1].adjust.

A group can have at most 60 nodes (MAX_NODES_PER_GROUP). For a private cluster (is_private: true) send custom_sku and host_ids and a mandatory vpc, instead of plan_id. On success the group is returned in Deploying state - poll List or Detail until it is Running.

project_id
required
integer

Identifier of the project to scope the request to. Required integer project ID.

Example

<PROJECT_ID>
apikey
required
string

API key used to authenticate the create request.

Example

<API_KEY>
location
required
string

Region in which the group will be provisioned.

Example

<LOCATION>
Media typeapplication/json

Create payload for an auto scaling group. Send policy for elastic (metric-based) scaling, scheduled_policy for cron-based scaling, or both - at least one is required. For a public group send plan_id; for a private cluster set is_private: true and send custom_sku, host_ids and a mandatory vpc instead.

object
name
required

Display name of the auto scaling group.

string

Example

web-autoscale-group
min_nodes
required

Minimum number of running nodes the group will maintain.

integer

Example

2
desired
required

Initial target number of running nodes. On create this equals min_nodes.

integer

Example

2
max_nodes
required

Maximum number of running nodes the group may scale to.

integer

Example

5
plan_id

ID of the compute plan (SKU) backing each node. Required for a public group (is_private false).

integer

Example

1088
plan_name

Human-readable plan name, from Plan.

string

Example

C3.8GB
slug_name

Plan slug identifier, from Plan.

string

Example

e2e_public_cloud
sku_id

SKU identifier for the selected plan.

integer

Example

12345
vm_image_id

ID of the image the nodes boot from.

integer

Example

12345
vm_image_name

Name of the selected image.

string

Example

Ubuntu-22.04
vm_template_id
required

Template ID of the selected image (its template_id).

integer

Example

12345
my_account_sg_id

ID of the security group to attach to the group’s nodes at create time.

integer

Example

12345
vpc

VPC networks to attach to the group. Mandatory for a private cluster.

Array<object>
object
name

VPC name.

string

Example

VPC-Example
network_id

VPC network ID.

integer

Example

12345
ipv4_cidr

IPv4 CIDR block of the VPC.

string

Example

10.8.46.0/23
state

VPC state.

string

Example

subnets

Subnets within the VPC.

Array
is_e2e_vpc

Whether this is an E2E-managed VPC.

boolean

Example

true
is_public_ip_required
required

Whether each node should be launched with a public IP.

boolean

Example

true
isEncryptionEnabled

Whether to enable disk encryption on the nodes.

boolean

Example

true
encryption_passphrase

Passphrase used for disk encryption. Required when isEncryptionEnabled is true.

string

Example

Secret@123
policy_type

Whether the elastic policy uses a Default metric (CPU/MEMORY) or a Custom parameter.

string
Allowed values: Default Custom

Example

Default
custom_parameter_name

Name of the custom scaling metric, when policy_type is Custom.

string

Example

REQUESTS_PER_SEC
custom_parameter_value

Initial value of the custom metric. Sent as 0 at create time.

integer

Example

0
is_private

Whether to launch the group on a private (dedicated) cluster.

boolean

Example

false
host_ids

IDs of the private-cluster hosts to place nodes on. Used when is_private is true.

Array<integer>
custom_sku

Custom node sizing for a private cluster. Used when is_private is true.

object
cpu

VCPU count per node.

integer

Example

4
memory

RAM per node, in GB.

integer

Example

8
disk

Root disk size per node, in GB.

integer

Example

100
cluster_id

ID of the private cluster to launch on.

integer

Example

12345
policy

Elastic (metric-based) scaling rules. Sent as two objects: a scale-up rule (adjust 1) and a scale-down rule (adjust -1).

Array<object>
object
type

Policy type. Always CHANGE for an elastic rule.

string

Example

CHANGE
adjust

Node count change applied when the rule fires (positive to scale up, negative to scale down).

integer

Example

1
parameter

Metric the rule watches.

string

Example

CPU
operator

Comparison operator between the metric and value.

string
Allowed values: > < >= <=

Example

>
value

Threshold the metric is compared against (a percentage for CPU/MEMORY).

integer

Example

60
period_number

Number of consecutive evaluation periods the condition must hold (watch period).

integer

Example

3
period

Length of each evaluation period, in seconds.

integer

Example

10
cooldown

Cooldown after a scaling action before the next one, in seconds.

integer

Example

150
scheduled_policy

Scheduled (cron-based) scaling rules. Sent as two objects: a scale-up and a scale-down target. scheduled_policy[0].adjust must be <= max_nodes, scheduled_policy[1].adjust must be >= min_nodes, and scheduled_policy[0].adjust must be >= scheduled_policy[1].adjust.

Array<object>
object
type

Policy type. Always CARDINALITY for a scheduled rule.

string

Example

CARDINALITY
adjust

Target number of running nodes when the schedule fires.

integer

Example

4
recurrence

Cron expression for when the rule fires.

string

Example

0 12 * * *

Example

{
"plan_id": 1088,
"plan_name": "C3.8GB",
"slug_name": "e2e_public_cloud",
"sku_id": 12345,
"vm_image_id": 12345,
"vm_image_name": "Ubuntu-22.04",
"vm_template_id": 12345,
"my_account_sg_id": 12345,
"name": "web-autoscale-group",
"min_nodes": 2,
"desired": 2,
"max_nodes": 5,
"vpc": [
{
"name": "VPC-Example",
"network_id": 12345,
"ipv4_cidr": "10.8.46.0/23",
"state": "",
"subnets": [],
"is_e2e_vpc": true
}
],
"is_public_ip_required": true,
"isEncryptionEnabled": true,
"encryption_passphrase": "Secret@123",
"policy_type": "Default",
"policy": [
{
"type": "CHANGE",
"adjust": 1,
"parameter": "CPU",
"operator": ">",
"value": 60,
"period_number": 3,
"period": 10,
"cooldown": 150
},
{
"type": "CHANGE",
"adjust": -1,
"parameter": "CPU",
"operator": "<",
"value": 30,
"period_number": 3,
"period": 10,
"cooldown": 150
}
],
"scheduled_policy": [
{
"type": "CARDINALITY",
"adjust": 4,
"recurrence": "0 12 * * *"
},
{
"type": "CARDINALITY",
"adjust": 2,
"recurrence": "0 2 * * *"
}
]
}

Successful response

Media typeapplication/json

The newly created auto scaling group, in Deploying state.

object
code
integer
data
object
id
string
name
string
plane_name
string
vm_image_name
string
provision_status
string
running
integer
desired
integer
tags
string
min_nodes
integer
max_nodes
integer
customer_id
integer
plan_id
integer
image_id
integer
nodes
Array
vpc_names
string
elastic_policy
object
type
string
policy
string
policy_measure
string
policy_op
string
upscale_policy_value
integer
downscale_policy_value
integer
wait_for_period
integer
wait_period
integer
cooldown
integer
scheduled_policy
object
type
string
scheduled_policy_ip
string
upscale_recurrence
string
upscale_adjust
integer
downscale_recurrence
string
downscale_adjust
integer
errors
object
message
string

Example

{
"code": 200,
"data": {
"id": "12345",
"name": "web-autoscale-group",
"plane_name": null,
"vm_image_name": "Ubuntu-22.04",
"provision_status": "Deploying",
"running": 0,
"desired": 2,
"tags": "",
"min_nodes": 2,
"max_nodes": 5,
"customer_id": 12345,
"plan_id": 1088,
"image_id": 12345,
"vpc_names": "VPC-Example",
"elastic_policy": {
"type": "CHANGE",
"policy": "CPU>60",
"policy_measure": "CPU",
"policy_op": ">",
"upscale_policy_value": 60,
"downscale_policy_value": 30,
"wait_for_period": 3,
"wait_period": 10,
"cooldown": 150
},
"scheduled_policy": {
"type": "CARDINALITY",
"scheduled_policy_ip": "scheduled_action",
"upscale_recurrence": "0 12 * * *",
"upscale_adjust": 4,
"downscale_recurrence": "0 2 * * *",
"downscale_adjust": 2
}
},
"message": "Success"
}