diff --git a/cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go b/cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go index f0a86127a904..b38b70d13a2c 100644 --- a/cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go +++ b/cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go @@ -128,8 +128,19 @@ 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 status + status, err := aws.awsManager.asgCache.InstanceStatus(*awsRef) + if status != nil { + return true, nil + } + + return false, fmt.Errorf("node is not present in aws: %v", err) } // Pricing returns pricing model for this cloud provider or error if not available.