Configure idle shutdown for compute instances

March 21, 2025 ยท View on GitHub

SYNOPSIS

Configure an idle shutdown timeout for Machine Learning compute instances.

DESCRIPTION

Machine Learning uses compute instances as a training or inference compute for development and testing. It's similar to a virtual machine on the cloud.

To avoid getting charged for a compute instance that is switched on but not being actively used, you can configure when to automatically shutdown compute instances due to inactivity.

RECOMMENDATION

Consider configuring ML - Compute Instances to automatically shutdown after a period of inactivity to optimize compute costs.

EXAMPLES

Configure with Azure template

To deploy compute instances that passes this rule:

  • Set the properties.properties.idleTimeBeforeShutdown property with a ISO 8601 formatted string. i.e. For an idle shutdown time of 15 minutes use PT15M.

For example:

{
  "type": "Microsoft.MachineLearningServices/workspaces/computes",
  "apiVersion": "2023-06-01-preview",
  "name": "[format('{0}/{1}', parameters('name'), parameters('name'))]",
  "location": "[parameters('location')]",
  "properties": {
    "computeType": "ComputeInstance",
    "disableLocalAuth": true,
    "properties": {
      "vmSize": "[parameters('vmSize')]",
      "idleTimeBeforeShutdown": "PT15M"
    }
  },
  "dependsOn": [
    "[resourceId('Microsoft.MachineLearningServices/workspaces', parameters('name'))]"
  ]
}

Configure with Bicep

To deploy compute instances that passes this rule:

  • Set the properties.properties.idleTimeBeforeShutdown property with a ISO 8601 formatted string. i.e. For an idle shutdown time of 15 minutes use PT15M.

For example:

resource compute_instance 'Microsoft.MachineLearningServices/workspaces/computes@2023-06-01-preview' = {
  parent: workspace
  name: name
  location: location
  properties: {
    computeType: 'ComputeInstance'
    disableLocalAuth: true
    properties: {
      vmSize: vmSize
      idleTimeBeforeShutdown: 'PT15M'
    }
  }
}