Search code examples
azure-machine-learning-service

How to get the existing AKS using compute target


How to get the existing AKS from the notebook that I have already added to AML. Create the cluster

attach_config = AksCompute.attach_configuration(resource_id=resource_id)
aks_target = ComputeTarget.attach(workspace=ws, name=create_name, attach_configuration=attach_config)
aks_target.wait_for_completion(True)

Solution

  • List all ComputeTarget objects within the workspace: Please follow the below link. https://learn.microsoft.com/en-us/python/api/azureml-core/azureml.core.compute.computetarget?view=azure-ml-py#list-workspace-

    you can do like as shown below.

    from azureml.core.compute import AksCompute, ComputeTarget
    aks_name = 'YOUR_EXISTING_CLUSTER_NAME’
    aks_target =AksCompute(ws, aks_name)