kubernetes/kops · error

error listing AutoScaling LaunchTemplates: %v

Error message

error listing AutoScaling LaunchTemplates: %v

What it means

Thrown when a paginated EC2 DescribeLaunchTemplates call (DescribeLaunchTemplatesPaginator) fails while discovering launch templates used by AutoScaling groups in the cluster VPC. Any page failure aborts the whole listing with this wrapped error.

Source

Thrown at pkg/resources/aws/aws.go:1316

	c := cloud.(awsup.AWSCloud)

	klog.V(2).Infof("Finding all AutoScaling LaunchTemplates owned by the cluster")

	input := &ec2.DescribeLaunchTemplatesInput{
		Filters: []ec2types.Filter{
			{
				Name:   aws.String("tag:kubernetes.io/cluster/" + clusterName),
				Values: []string{"owned"},
			},
		},
	}

	var list []*resources.Resource
	paginator := ec2.NewDescribeLaunchTemplatesPaginator(c.EC2(), input)
	for paginator.HasMorePages() {
		page, err := paginator.NextPage(ctx)
		if err != nil {
			return nil, fmt.Errorf("error listing AutoScaling LaunchTemplates: %v", err)
		}
		for _, lt := range page.LaunchTemplates {
			list = append(list, &resources.Resource{
				Name:    aws.ToString(lt.LaunchTemplateName),
				ID:      aws.ToString(lt.LaunchTemplateId),
				Type:    TypeAutoscalingLaunchConfig,
				Deleter: DeleteAutoScalingGroupLaunchTemplate,
			})
		}
	}

	return list, nil
}

func FindNatGateways(cloud fi.Cloud, routeTables map[string]*resources.Resource, clusterName string) ([]*resources.Resource, error) {
	if len(routeTables) == 0 {
		return nil, nil
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run `aws ec2 describe-launch-templates` to reproduce the underlying error.
  2. Grant ec2:DescribeLaunchTemplates in IAM.
  3. Retry after throttling backoff; consider reducing parallel kops operations.
  4. Refresh credentials if AuthFailure/ExpiredToken.
Defensive patterns

Strategy: retry

Validate before calling

_, err := ec2Client.DescribeLaunchTemplates(ctx, &ec2.DescribeLaunchTemplatesInput{MaxResults: aws.Int32(1)}); if err != nil { /* resolve IAM/creds before full listing */ }

Type guard

func isThrottling(err error) bool { var ae smithy.APIError; return errors.As(err, &ae) && (ae.ErrorCode() == "ThrottlingException" || ae.ErrorCode() == "RequestLimitExceeded") }

Try / catch

lts, err := FindAutoScalingLaunchTemplates(cloud, vpcID, clusterName)
if err != nil {
	if isThrottling(err) { time.Sleep(backoff); lts, err = FindAutoScalingLaunchTemplates(...) }
	if err != nil { return err }
}

Prevention

When it happens

Trigger: DescribeLaunchTemplates pagination returns UnauthorizedOperation, ThrottlingException, AuthFailure, or InvalidFilter on any page.

Common situations: IAM policy lacking ec2:DescribeLaunchTemplates; API rate limiting during large cluster enumeration; expired session token mid-scan.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/cdb96ca6105f13c6. Report an issue: GitHub.