diff --git a/cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go b/cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go index f0a86127a904..59c949f57a25 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go +++ b/cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go @@ -128,8 +128,18 @@ func (aws *awsCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovider.N } // HasInstance returns whether a given node has a corresponding instance in this cloud provider -func (aws *awsCloudProvider) HasInstance(*apiv1.Node) (bool, error) { - return true, cloudprovider.ErrNotImplemented +func (aws *awsCloudProvider) HasInstance(node *apiv1.Node) (bool, error) { + awsRef, err := AwsRefFromProviderId(node.Spec.ProviderID) + if err != nil { + return false, err + } + + // we don't care about the instance health + if _, ok := aws.awsManager.asgCache.instanceStatus[*awsRef]; !ok { + return false, fmt.Errorf("node isn't present in aws") + } + + return true, nil } // Pricing returns pricing model for this cloud provider or error if not available.