kubernetes/kops · error

error checking if instance type %q is supported in region %q

Error message

error checking if instance type %q is supported in region %q: %v

What it means

zonesWithInstanceType calls EC2 DescribeReservedInstancesOfferings to determine which availability zones support a given instance type. If that AWS API call fails, the error is wrapped with the instance type and region. It reports an AWS API failure during instance-type support probing, not a conclusion about the type itself.

Source

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

}

// supportsInstanceType uses the DescribeReservedInstancesOfferings API call to determine if an instance type is supported in a region
func (c *awsCloudImplementation) zonesWithInstanceType(instanceType ec2types.InstanceType) (sets.String, error) {
	klog.V(4).Infof("checking if instance type %q is supported in region %q", instanceType, c.region)
	ctx := context.TODO()
	request := &ec2.DescribeReservedInstancesOfferingsInput{}
	request.InstanceTenancy = ec2types.TenancyDefault
	request.IncludeMarketplace = aws.Bool(false)
	request.OfferingClass = ec2types.OfferingClassTypeStandard
	request.OfferingType = ec2types.OfferingTypeValuesNoUpfront
	request.ProductDescription = ec2types.RIProductDescriptionLinuxUnixAmazonVpc
	request.InstanceType = instanceType

	zones := sets.NewString()

	response, err := c.ec2.DescribeReservedInstancesOfferings(ctx, request)
	if err != nil {
		return zones, fmt.Errorf("error checking if instance type %q is supported in region %q: %v", instanceType, c.region, err)
	}

	for _, item := range response.ReservedInstancesOfferings {
		if item.InstanceType == instanceType {
			zones.Insert(aws.ToString(item.AvailabilityZone))
		} else {
			klog.Warningf("skipping non-matching instance type offering: %v", item)
		}
	}

	return zones, nil
}

// DescribeInstanceType calls ec2.DescribeInstanceType to get information for a particular instance type
func (c *awsCloudImplementation) DescribeInstanceType(instanceType string) (*ec2types.InstanceTypeInfo, error) {
	if info, ok := c.instanceTypes.typeMap[instanceType]; ok {
		return info, nil
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped %v cause to identify the AWS error code (auth vs throttling vs invalid parameter).
  2. Grant the credentials ec2:DescribeReservedInstancesOfferings permission.
  3. If throttled, add exponential backoff around the call and retry.
  4. Verify the instance type string is a valid EC2 type for that region.
  5. Check network connectivity to the regional EC2 endpoint (VPC endpoints/proxy/DNS).

Example fix

// before: single attempt
response, err := c.ec2.DescribeReservedInstancesOfferings(ctx, request)
if err != nil { return zones, fmt.Errorf(...) }
// after: tolerate API failure instead of failing provisioning
response, err := c.ec2.DescribeReservedInstancesOfferings(ctx, request)
if err != nil {
    klog.Warningf("DescribeReservedInstancesOfferings failed for %s: %v; assuming all zones", instanceType, err)
    return nil, nil
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify EC2 permissions and connectivity first
aws ec2 describe-reserved-instances-offerings --region <region> --max-results 1

Try / catch

zones, err := c.zonesWithInstanceType(instanceType)
if err != nil {
    klog.Warningf("instance-type probe failed (%v); defaulting to all configured zones", err)
    zones = sets.NewString(clusterZones...)
}

Prevention

When it happens

Trigger: c.ec2.DescribeReservedInstancesOfferings(ctx, request) returns an error — AuthFailure/UnauthorizedOperation (missing ec2:DescribeReservedInstancesOfferings), throttling, InvalidParameterValue (malformed instance type), or network/endpoint failure.

Common situations: Read-only IAM policies missing EC2 reserved-instances describe permission; AWS throttling on accounts with heavy API usage; corporate proxy/firewall blocking EC2 endpoints; passing an instance-type string not valid for EC2.

Related errors


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