kubernetes/kops · error
error listing AutoScaling LaunchTemplates
Error message
error listing AutoScaling LaunchTemplates: %v
What it means
findAllLaunchTemplates pages through ec2:DescribeLaunchTemplates to collect all kOps-managed launch templates, and wraps any paginator error in this message. It is thrown from FindDeletions when the AWS API call itself fails, so the list of orphaned launch templates cannot be computed.
Solutions
- Check the wrapped %v error for the exact AWS error code
- Grant ec2:DescribeLaunchTemplates to the kOps IAM role/policy
- Retry the operation; throttling errors are transient
- Verify AWS credentials and region configuration (aws sts get-caller-identity)
Defensive patterns
Strategy: retry
Validate before calling
// pre-check IAM
_, err := cloud.EC2().DescribeLaunchTemplates(ctx, &ec2types.DescribeLaunchTemplatesInput{MaxResults: aws.Int32(1)})
if err != nil { /* fail fast: describe permission missing */ } Try / catch
page, err := paginator.NextPage(ctx)
if err != nil {
var re *awshttp.ResponseError
if errors.As(err, &re) && strings.Contains(re.Error(), "Throttling") {
time.Sleep(backoff); continue
}
return nil, fmt.Errorf("error listing AutoScaling LaunchTemplates: %w", err)
} Prevention
- Grant ec2:DescribeLaunchTemplates to the kOps role
- Add exponential backoff for paginated calls
- Verify region/profile before running kops
When it happens
Trigger: paginator.NextPage returns an error: API throttling, UnauthorizedOperation/AccessDenied on ec2:DescribeLaunchTemplates, invalid filter values, network failure, or region misconfiguration.
Common situations: IAM policy lacking ec2:DescribeLaunchTemplates, heavy API load causing rate limiting, wrong AWS_PROFILE/region, transient network errors in CI.
Related errors
- error creating LaunchTemplate
- error creating LaunchTemplateVersion
- error decoding userdata
- error deleting ec2 LaunchTemplate
- error deleting LaunchTemplate
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/0508f173d69ebb06.
Report an issue: GitHub.
Appendix: source
Thrown at upup/pkg/fi/cloudup/awstasks/launchtemplate_target_api.go:377
ctx := c.Context()
cloud := awsup.GetCloud(c)
input := &ec2.DescribeLaunchTemplatesInput{
Filters: []ec2types.Filter{
{
Name: aws.String("tag:Name"),
Values: []string{fi.ValueOf(t.Name)},
},
},
}
var list []ec2types.LaunchTemplate
paginator := ec2.NewDescribeLaunchTemplatesPaginator(cloud.EC2(), input)
for paginator.HasMorePages() {
page, err := paginator.NextPage(ctx)
if err != nil {
return nil, fmt.Errorf("error listing AutoScaling LaunchTemplates: %v", err)
}
list = append(list, page.LaunchTemplates...)
}
return list, nil
}
// findLatestLaunchTemplateVersion returns the latest template version
func (t *LaunchTemplate) findLatestLaunchTemplateVersion(c *fi.CloudupContext) (*ec2types.LaunchTemplateVersion, error) {
ctx := c.Context()
cloud := awsup.GetCloud(c)
input := &ec2.DescribeLaunchTemplateVersionsInput{
LaunchTemplateName: t.Name,
Versions: []string{("$Latest")},
}
View on GitHub (pinned to 4c8573c808)