kubernetes/kops · error

error creating AutoScalingGroup: %s

Error message

error creating AutoScalingGroup: %s

What it means

CreateAutoScalingGroup API call failed; kOps wraps the AWS error message. One special case is recognized first: 'Invalid IAM Instance Profile name' is converted to a TryAgainLaterError so apply retries while IAM propagation completes.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go:431

			}
		} else if e.LaunchTemplate != nil {
			request.LaunchTemplate = &autoscalingtypes.LaunchTemplateSpecification{
				LaunchTemplateId: e.LaunchTemplate.ID,
				Version:          aws.String("$Latest"),
			}
		} else {
			return fmt.Errorf("could not find one of launch template or mixed instances policy")
		}

		// @step: attempt to create the autoscaling group for us
		if _, err := t.Cloud.Autoscaling().CreateAutoScalingGroup(ctx, request); err != nil {
			code := awsup.AWSErrorCode(err)
			message := awsup.AWSErrorMessage(err)
			if code == "ValidationError" && strings.Contains(message, "Invalid IAM Instance Profile name") {
				klog.V(4).Infof("error creating AutoscalingGroup: %s", message)
				return fi.NewTryAgainLaterError("waiting for the IAM Instance Profile to be propagated")
			}
			return fmt.Errorf("error creating AutoScalingGroup: %s", message)
		}

		// @step: attempt to enable the metrics for us
		if _, err := t.Cloud.Autoscaling().EnableMetricsCollection(ctx, &autoscaling.EnableMetricsCollectionInput{
			AutoScalingGroupName: e.Name,
			Granularity:          e.Granularity,
			Metrics:              e.Metrics,
		}); err != nil {
			return fmt.Errorf("error enabling metrics collection for AutoscalingGroup: %v", err)
		}

		if len(*e.SuspendProcesses) > 0 {
			processQuery := &autoscaling.SuspendProcessesInput{}
			processQuery.AutoScalingGroupName = e.Name
			processQuery.ScalingProcesses = *e.SuspendProcesses

			if _, err := t.Cloud.Autoscaling().SuspendProcesses(ctx, processQuery); err != nil {
				return fmt.Errorf("error suspending processes: %v", err)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. If the message says 'Invalid IAM Instance Profile name', just re-run apply after ~30s — IAM needs time to propagate (kOps will retry automatically)
  2. Check the embedded AWS message for the real cause (ValidationErrors name the offending field)
  3. Verify subnets, min/max size, and that no ASG with the same name exists
  4. Check service quotas for AutoScaling groups in the region

Example fix

// before: immediate hard failure
return fmt.Errorf("error creating AutoScalingGroup: %s", message)
// after (what kOps does for IAM propagation)
if code == "ValidationError" && strings.Contains(message, "Invalid IAM Instance Profile name") {
	return fi.NewTryAgainLaterError("waiting for the IAM Instance Profile to be propagated")
}
Defensive patterns

Strategy: retry

Validate before calling

aws iam get-instance-profile --instance-profile-name nodes-instance-profile-<cluster> # exists?
aws autoscaling create-auto-scaling-group --generate-cli-skeleton # validate fields before apply

Try / catch

retryuntil(30*time.Second, func() error {
  if err := applyCluster(); err != nil &&
     strings.Contains(err.Error(), "Invalid IAM Instance Profile name") {
    return ErrRetry // IAM propagation lag
  }
  return err
})

Prevention

When it happens

Trigger: CreateAutoScalingGroup returns an error — most commonly a newly created instance profile not yet propagated to IAM, invalid VPC-subzone/min-size parameters (ValidationError), or the ASG name already existing in another state.

Common situations: First apply right after IAM role creation; typos in subnets/zones; ASG limits exceeded in the region.

Related errors


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