{"record":{"id":"967aa017559b3edd","repo":"kubernetes/kops","slug":"error-describing-autoscalinggroups-v","errorCode":null,"errorMessage":"error describing autoScalingGroups: %v","messagePattern":"error describing autoScalingGroups: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_cloud.go","lineNumber":522,"sourceCode":"\t\t} else {\n\t\t\treturn fmt.Errorf(\"error deleting instance %q: %v\", id, err)\n\t\t}\n\t}\n\n\tklog.V(8).Infof(\"deleted aws ec2 instance %q\", id)\n\n\treturn nil\n}\n\n// deregisterInstance ensures that the instance is fully drained/removed from all associated loadBalancers and targetGroups before termination.\nfunc deregisterInstance(ctx context.Context, c AWSCloud, i *cloudinstances.CloudInstance) error {\n\tasg := i.CloudInstanceGroup.Raw.(*autoscalingtypes.AutoScalingGroup)\n\n\tasgDetails, err := c.Autoscaling().DescribeAutoScalingGroups(ctx, &autoscaling.DescribeAutoScalingGroupsInput{\n\t\tAutoScalingGroupNames: []string{aws.ToString(asg.AutoScalingGroupName)},\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error describing autoScalingGroups: %v\", err)\n\t}\n\n\tif len(asgDetails.AutoScalingGroups) == 0 {\n\t\treturn nil\n\t}\n\n\t// there will always be only one ASG in the DescribeAutoScalingGroups response.\n\tloadBalancerNames := asgDetails.AutoScalingGroups[0].LoadBalancerNames\n\ttargetGroupArns := asgDetails.AutoScalingGroups[0].TargetGroupARNs\n\n\teg, _ := errgroup.WithContext(context.Background())\n\n\tif len(loadBalancerNames) != 0 {\n\t\teg.Go(func() error {\n\t\t\treturn deregisterInstanceFromClassicLoadBalancer(ctx, c, loadBalancerNames, i.ID)\n\t\t})\n\t}\n","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_cloud.go#L504-L540","documentation":"deregisterInstance() re-fetches the Auto Scaling Group via DescribeAutoScalingGroups to learn which Classic ELBs and target groups the instance must be drained from; if that AWS API call fails, this error wraps the SDK error. Without the ASG details kOps cannot determine the load balancer set, so deregistration aborts.","triggerScenarios":"deregisterInstance calls c.Autoscaling().DescribeAutoScalingGroups with the instance's ASG name and AWS returns an error: throttling (RequestLimitExceeded), AccessDenied, InvalidGroupName.NotFound, or network failure.","commonSituations":"IAM policy missing autoscaling:DescribeAutoScalingGroups; ASG deleted while kOps still holds a reference to it; API throttling during large rolling updates across many groups; temporary AWS API outage.","solutions":["Verify the IAM policy grants autoscaling:DescribeAutoScalingGroups","Check the ASG still exists (name comes from the cached CloudInstanceGroup.Raw) — if deleted, refresh cluster state and retry","Retry the operation; throttling errors (Throttling/RequestLimitExceeded) are transient — reduce concurrency for huge updates","Check AWS region configuration matches where the cluster's ASGs live"],"exampleFix":"// before: policy missing\n// error describing autoScalingGroups: AccessDenied: User is not authorized to perform: autoscaling:DescribeAutoScalingGroups\n// after: add to IAM policy statement\n{\"Effect\":\"Allow\",\"Action\":[\"autoscaling:DescribeAutoScalingGroups\"],\"Resource\":\"*\"}","handlingStrategy":"retry","validationCode":"_, err := asgSvc.DescribeAutoScalingGroups(&autoscaling.DescribeAutoScalingGroupsInput{\n\tAutoScalingGroupNames: []string{asgName}})\nif err != nil {\n\treturn fmt.Errorf(\"precheck failed: %w\", err)\n}","typeGuard":"func isThrottle(err error) bool {\n\tvar ae smithy.APIError\n\treturn errors.As(err, &ae) && (ae.ErrorCode() == \"Throttling\" || ae.ErrorCode() == \"RequestLimitExceeded\")\n}","tryCatchPattern":"if err := cloud.DeregisterInstance(inst); err != nil {\n\tif strings.Contains(err.Error(), \"error describing autoScalingGroups\") {\n\t\t// retry with backoff; throttling/describe failures are usually transient\n\t\treturn retryWithBackoff(3, 5*time.Second, func() error { return cloud.DeregisterInstance(inst) })\n\t}\n\treturn err\n}","preventionTips":["Include autoscaling:DescribeAutoScalingGroups in the IAM policy","Don't delete ASGs out-of-band during rolling updates","Throttle concurrency on very large clusters to avoid RequestLimitExceeded","Keep client region aligned with the cluster region"],"tags":["aws","autoscaling","api-error","permissions"],"backgroundTag":"aws-api-call-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}