Review Databricks AWS node allocation

Check whether spot nodes, on-demand nodes and availability-zone selection meet the recovery needs of a Databricks AWS cluster.

Description

On AWS, first_on_demand sets how many Databricks nodes to place on demand, starting with the driver. The remaining nodes use the availability setting.

Potential impact

Reclaimed spot nodes can interrupt a job. Recovery, retries and switching to on-demand workers can increase run time or cost.

Remediation

Use on-demand nodes for work that cannot tolerate interruption. To use spot workers with an on-demand alternative, choose SPOT_WITH_FALLBACK. Set first_on_demand to at least 1 to keep the driver on demand. Test recovery and costs after interruption.

Examples

Both excerpts set first_on_demand = 1. The runtime and node-type data sources are omitted.

Before

hcl
resource "databricks_cluster" "example" {
  cluster_name            = "data"
  spark_version           = data.databricks_spark_version.latest.id
  node_type_id            = data.databricks_node_type.smallest.id
  autotermination_minutes = 20

  autoscale {
    min_workers = 1
    max_workers = 50
  }

  aws_attributes {
    availability           = "SPOT"
    zone_id                = "auto"
    first_on_demand        = 1
    spot_bid_price_percent = 100
  }
}

After

hcl
resource "databricks_cluster" "example" {
  cluster_name            = "Shared Autoscaling"
  spark_version           = data.databricks_spark_version.latest.id
  node_type_id            = data.databricks_node_type.smallest.id
  autotermination_minutes = 20

  autoscale {
    min_workers = 1
    max_workers = 50
  }

  aws_attributes {
    availability           = "SPOT_WITH_FALLBACK"
    zone_id                = "auto"
    first_on_demand        = 1
    spot_bid_price_percent = 100
  }
}

The first requests SPOT workers. The second can request on-demand workers when spot capacity is unavailable. In both, zone_id = "auto" selects one availability zone at launch.

References