kubernetes/kops · error

describing instance type %q in region %q: %w

Error message

describing instance type %q in region %q: %w

What it means

This error wraps a failure from the AWS EC2 DescribeInstanceTypes API call in kOps' awsup cloud implementation (aws_cloud.go:2097). kOps calls DescribeInstanceTypes to fetch vCPU/memory metadata for an instance type before using it in cluster provisioning. The %w wrap means the underlying AWS SDK error (auth, network, throttling, invalid name) is preserved for errors.Is/As inspection.

Source

Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:2097

	c.instanceTypes.mutex.Lock()
	defer c.instanceTypes.mutex.Unlock()

	info, err := describeInstanceType(c, instanceType)
	if err != nil {
		return nil, err
	}
	c.instanceTypes.typeMap[instanceType] = info
	return info, nil
}

func describeInstanceType(c AWSCloud, instanceType string) (*ec2types.InstanceTypeInfo, error) {
	ctx := context.TODO()
	req := &ec2.DescribeInstanceTypesInput{
		InstanceTypes: []ec2types.InstanceType{ec2types.InstanceType(instanceType)},
	}
	resp, err := c.EC2().DescribeInstanceTypes(ctx, req)
	if err != nil {
		return nil, fmt.Errorf("describing instance type %q in region %q: %w", instanceType, c.Region(), err)
	}
	if len(resp.InstanceTypes) != 1 {
		return nil, fmt.Errorf("instance type %q not found in region %q", instanceType, c.Region())
	}
	return &resp.InstanceTypes[0], nil
}

// AccountInfo returns the AWS account ID and AWS partition that we are deploying into
func (c *awsCloudImplementation) AccountInfo(ctx context.Context) (string, string, error) {
	request := &sts.GetCallerIdentityInput{}

	response, err := c.sts.GetCallerIdentity(ctx, request)
	if err != nil {
		return "", "", fmt.Errorf("error getting AWS account ID: %v", err)
	}

	arn, err := arn.Parse(aws.ToString(response.Arn))
	if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the instance type name is valid for the region (aws ec2 describe-instance-types --region <region> or check AWS docs); fix typos in the cluster spec.
  2. Check AWS credentials: run 'aws sts get-caller-identity' with the same profile/env kOps uses; refresh expired keys or fix AWS_PROFILE.
  3. Confirm network reachability to ec2.<region>.amazonaws.com (proxy/VPN/firewall settings).
  4. If the underlying error is throttling, retry with backoff or reduce concurrent kOps API calls.
  5. Ensure the region in the kOps config supports the chosen instance type (newer types are region-gated).

Example fix

// before (cluster spec)
instanceType: t3.meduim
// after
instanceType: t3.medium
Defensive patterns

Strategy: retry

Validate before calling

// validate the instance type name client-side before calling kOps/EC2
func validInstanceTypeName(name string) bool {
	if name == "" || strings.ToLower(name) != name { return false }
	parts := strings.SplitN(name, ".", 2)
	return len(parts) == 2 && parts[0] != "" && parts[1] != ""
}
// if err := awsProfileCheck(); err != nil { ... }  // 'aws sts get-caller-identity' as a preflight

Type guard

func isAWSSDKError(err error) (retryable bool) {
	var rae interface{ ErrorCode() string }
	if errors.As(err, &rae) {
		switch rae.ErrorCode() {
		case "RequestLimitExceeded", "ThrottlingException", "RequestTimeout":
			return true
		}
	}
	return false
}

Try / catch

_, err := DescribeInstanceType(name)
if err != nil {
	var apiErr smithy.APIError
	if errors.As(err, &apiErr) && (apiErr.ErrorCode() == "RequestLimitExceeded" || apiErr.ErrorCode() == "ThrottlingException") {
		// retry with exponential backoff
	} else {
		return fmt.Errorf("instance type %s unusable: %w", name, err)
	}
}

Prevention

When it happens

Trigger: Calling the function that describes an instance type when c.EC2().DescribeInstanceTypes returns any error: invalid/unknown instance type name, expired or missing AWS credentials, no network connectivity to EC2, regional endpoint issues, or API throttling (RequestLimitExceeded).

Common situations: Typo'd KubernetesCluster master/node instance type in the cluster spec (e.g. 't3.meduim'); AWS credentials missing or expired in the environment; running in an air-gapped/proxied environment where EC2 endpoints are blocked; hitting EC2 rate limits during large cluster creation.

Related errors


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