diff --git a/upup/pkg/fi/cloudup/awsup/aws_cloud.go b/upup/pkg/fi/cloudup/awsup/aws_cloud.go index dd7fdc508b7e4..d868d40ff28c3 100644 --- a/upup/pkg/fi/cloudup/awsup/aws_cloud.go +++ b/upup/pkg/fi/cloudup/awsup/aws_cloud.go @@ -847,9 +847,11 @@ func addCloudInstanceData(cm *cloudinstances.CloudInstance, instance *ec2.Instan } func findInstances(c AWSCloud, ig *kops.InstanceGroup) (map[string]*ec2.Instance, error) { + clusterName, _ := c.Tags()[TagClusterName] req := &ec2.DescribeInstancesInput{ Filters: []*ec2.Filter{ NewEC2Filter("tag:"+identity_aws.CloudTagInstanceGroupName, ig.ObjectMeta.Name), + NewEC2Filter("tag:"+TagClusterName, clusterName), NewEC2Filter("instance-state-name", "pending", "running", "stopping", "stopped"), }, } @@ -871,9 +873,11 @@ func findInstances(c AWSCloud, ig *kops.InstanceGroup) (map[string]*ec2.Instance } func findDetachedInstances(c AWSCloud, g *autoscaling.Group) ([]*string, error) { + clusterName, _ := c.Tags()[TagClusterName] req := &ec2.DescribeInstancesInput{ Filters: []*ec2.Filter{ NewEC2Filter("tag:"+tagNameDetachedInstance, aws.StringValue(g.AutoScalingGroupName)), + NewEC2Filter("tag:"+TagClusterName, clusterName), NewEC2Filter("instance-state-name", "pending", "running", "stopping", "stopped"), }, }