kubernetes/kops · error

instance type %q not found in region %q

Error message

instance type %q not found in region %q

What it means

Returned when EC2 DescribeInstanceTypes succeeds but returns zero results for the requested instance type (aws_cloud.go:2100). AWS silently omits unknown or region-unsupported instance type names instead of erroring, so kOps explicitly fails with this message. It means the name was accepted as a request but does not exist in that region.

Source

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

	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 {
		return "", "", fmt.Errorf("failed to parse GetCallerIdentity ARN: %w", err)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the instance type exists in the target region: 'aws ec2 describe-instance-types --region <region> --instance-types <type>'.
  2. Fix the spelling/case of the instance type in the cluster spec (lowercase, correct family, e.g. t3.medium).
  3. Pick a substitute type offered in the region, or change the cluster region to one that offers the type.
  4. If using a very new instance type, upgrade kOps to a version whose AWS SDK knows the name.

Example fix

// before (cluster spec, region us-east-2)
instanceType: c7a.metal-48xl
// after
instanceType: c7a.4xlarge
Defensive patterns

Strategy: validation

Validate before calling

// check the type exists in the region BEFORE provisioning
func instanceTypeExists(ctx context.Context, client *ec2.Client, region, name string) (bool, error) {
	out, err := client.DescribeInstanceTypes(ctx, &ec2.DescribeInstanceTypesInput{
		InstanceTypes: []ec2types.InstanceType{ec2types.InstanceType(name)},
	})
	if err != nil { return false, err }
	return len(out.InstanceTypes) == 1, nil
}

Type guard

func isNotFoundInstanceType(err error) bool {
	return err != nil && strings.Contains(err.Error(), "not found in region")
}

Try / catch

if err := ensureInstanceType(name, region); err != nil {
	if isNotFoundInstanceType(err) {
		return fmt.Errorf("%s is not offered in %s; pick one from 'aws ec2 describe-instance-types --region %s'", name, region, region)
	}
	return err
}

Prevention

When it happens

Trigger: DescribeInstanceTypes returns resp.InstanceTypes with len != 1 — almost always len 0 — because the instance type string is misspelled, malformed (wrong case, e.g. 'T3.Medium'), or not offered in c.Region().

Common situations: Using an instance type unavailable in the selected region (e.g. m7g in a region without Graviton support); typo in the kops cluster spec; using a type name with wrong capitalization; referencing a type from a newer AWS generation than the SDK/region supports.

Related errors


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