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 * * *" } ]}'import requests
response = requests.post( "https://api.e2enetworks.com/myaccount/api/v1/scaler/scalegroups", params={"project_id": "<PROJECT_ID>", "apikey": "<API_KEY>", "location": "<LOCATION>"}, headers={"Authorization": "Bearer <API_TOKEN>"}, json={ "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 * * *", }, ], },)print(response.json())const url = new URL("https://api.e2enetworks.com/myaccount/api/v1/scaler/scalegroups");url.search = new URLSearchParams({ project_id: "<PROJECT_ID>", apikey: "<API_KEY>", location: "<LOCATION>" });
const response = await fetch(url, { method: "POST", headers: { "Authorization": "Bearer <API_TOKEN>", "Content-Type": "application/json" }, body: JSON.stringify({ "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 * * *" } ] }),});console.log(await response.json());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
policyreacts 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_policychanges the target node count on a cron schedule. It is sent as two objects (scale-up and scale-down), wherescheduled_policy[0].adjust<=max_nodes,scheduled_policy[1].adjust>=min_nodes, andscheduled_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.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Identifier of the project to scope the request to. Required integer project ID.
Example
<PROJECT_ID>API key used to authenticate the create request.
Example
<API_KEY>Region in which the group will be provisioned.
Example
<LOCATION>Request Body
Section titled “Request Body”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
Display name of the auto scaling group.
Example
web-autoscale-groupMinimum number of running nodes the group will maintain.
Example
2Initial target number of running nodes. On create this equals min_nodes.
Example
2Maximum number of running nodes the group may scale to.
Example
5ID of the compute plan (SKU) backing each node. Required for a public group (is_private false).
Example
1088Human-readable plan name, from Plan.
Example
C3.8GBPlan slug identifier, from Plan.
Example
e2e_public_cloudSKU identifier for the selected plan.
Example
12345ID of the image the nodes boot from.
Example
12345Name of the selected image.
Example
Ubuntu-22.04Template ID of the selected image (its template_id).
Example
12345ID of the security group to attach to the group’s nodes at create time.
Example
12345VPC networks to attach to the group. Mandatory for a private cluster.
object
VPC name.
Example
VPC-ExampleVPC network ID.
Example
12345IPv4 CIDR block of the VPC.
Example
10.8.46.0/23VPC state.
Example
Subnets within the VPC.
Whether this is an E2E-managed VPC.
Example
trueWhether each node should be launched with a public IP.
Example
trueWhether to enable disk encryption on the nodes.
Example
truePassphrase used for disk encryption. Required when isEncryptionEnabled is true.
Example
Secret@123Whether the elastic policy uses a Default metric (CPU/MEMORY) or a Custom parameter.
Example
DefaultName of the custom scaling metric, when policy_type is Custom.
Example
REQUESTS_PER_SECInitial value of the custom metric. Sent as 0 at create time.
Example
0Whether to launch the group on a private (dedicated) cluster.
Example
falseIDs of the private-cluster hosts to place nodes on. Used when is_private is true.
Custom node sizing for a private cluster. Used when is_private is true.
object
VCPU count per node.
Example
4RAM per node, in GB.
Example
8Root disk size per node, in GB.
Example
100ID of the private cluster to launch on.
Example
12345Elastic (metric-based) scaling rules. Sent as two objects: a scale-up rule (adjust 1) and a scale-down rule (adjust -1).
object
Policy type. Always CHANGE for an elastic rule.
Example
CHANGENode count change applied when the rule fires (positive to scale up, negative to scale down).
Example
1Metric the rule watches.
Example
CPUComparison operator between the metric and value.
Example
>Threshold the metric is compared against (a percentage for CPU/MEMORY).
Example
60Number of consecutive evaluation periods the condition must hold (watch period).
Example
3Length of each evaluation period, in seconds.
Example
10Cooldown after a scaling action before the next one, in seconds.
Example
150Scheduled (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.
object
Policy type. Always CARDINALITY for a scheduled rule.
Example
CARDINALITYTarget number of running nodes when the schedule fires.
Example
4Cron expression for when the rule fires.
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 * * *" } ]}Responses
Section titled “Responses”Successful response
The newly created auto scaling group, in Deploying state.
object
object
object
object
object
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"}