Skip to content

Configure idle shutdown for compute instances#

Cost Optimization · Machine Learning · Rule · 2023_12 · Critical

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:

Azure Template snippet
{
  "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:

Azure Bicep snippet
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'
    }
  }
}

Comments