Skip to content
  • Auto
  • Light
  • Dark

Create

Create a New Autoscale Pool
gpu_droplets.autoscale.create(AutoscaleCreateParams**kwargs) -> autoscale_poolAutoscalePoolAutoscaleCreateResponse
post/v2/droplets/autoscale

To create a new autoscale pool, send a POST request to /v2/droplets/autoscale setting the required attributes.

The response body will contain a JSON object with a key called autoscale_pool containing the standard attributes for the new autoscale pool.

Parameters
configConfig

The scaling configuration for an autoscale pool, which is how the pool scales up and down (either by resource utilization or static configuration).

Hide ParametersShow Parameters
target_number_instancesintAutoscalePoolStaticConfigParam
max_instancesintmin_instancesintcooldown_minutesinttarget_cpu_utilizationfloattarget_memory_utilizationfloatAutoscalePoolDynamicConfigParam
droplet_templateimagestrregionliteralsizestrssh_keyslistipv6boolnamestrproject_idstrtagslistuser_datastrvpc_uuidstrwith_droplet_agentboolAutoscalePoolDropletTemplateParam
namestr

The human-readable name of the autoscale pool. This field cannot be updated

Returns
AutoscaleCreateResponseclass
Hide ParametersShow Parameters
autoscale_poolAutoscalePool
optional
from do_gradientai import GradientAI

client = GradientAI()
autoscale = client.gpu_droplets.autoscale.create(
    config={
        "min_instances": 1,
        "max_instances": 5,
        "target_cpu_utilization": 0.5,
        "cooldown_minutes": 10,
    },
    droplet_template={
        "name": "example.com",
        "region": "nyc3",
        "size": "c-2",
        "image": "ubuntu-20-04-x64",
        "ssh_keys": ["3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"],
        "backups": True,
        "ipv6": True,
        "monitoring": True,
        "tags": ["env:prod", "web"],
        "user_data": "#cloud-config\nruncmd:\n  - touch /test.txt\n",
        "vpc_uuid": "760e09ef-dc84-11e8-981e-3cfdfeaae000",
    },
    name="my-autoscale-pool",
)
print(autoscale.autoscale_pool)
200 Example
{
  "autoscale_pool": {
    "id": "0d3db13e-a604-4944-9827-7ec2642d32ac",
    "name": "test-autoscaler-group-01",
    "config": {
      "min_instances": 1,
      "max_instances": 5,
      "target_cpu_utilization": 0.5,
      "cooldown_minutes": 10
    },
    "droplet_template": {
      "name": "droplet-name",
      "size": "c-2",
      "region": "tor1",
      "image": "ubuntu-20-04-x64",
      "tags": [
        "my-tag"
      ],
      "ssh_keys": [
        "3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"
      ],
      "vpc_uuid": "760e09ef-dc84-11e8-981e-3cfdfeaae000",
      "with_droplet_agent": true,
      "project_id": "746c6152-2fa2-11ed-92d3-27aaa54e4988",
      "ipv6": true,
      "user_data": "#cloud-config\nruncmd:\n  - touch /test.txt\n"
    },
    "created_at": "2020-11-19T20:27:18Z",
    "updated_at": "2020-12-01T00:42:16Z",
    "status": "active",
    "active_resources_count": 1
  }
}