kubernetes/kops · error
instance type %q not found in region %q
Error message
instance type %q not found in region %q
What it means
GetMachineTypeInfo calls ec2.DescribeInstanceTypes for a single instance type and expects exactly one result. AWS returns an empty (not an error) result when the instance type name is unknown or not offered in the configured region, so kOps converts that empty response into this explicit error. It means the machine type string passed in does not exist as specified in c.region.
Source
Thrown at upup/pkg/fi/nodeup/awsup/machine_types.go:51
}
// GetMachineTypeInfo calls ec2.DescribeInstanceTypes to get information for a particular instance type, caching the result.
func (c *Cloud) GetMachineTypeInfo(ctx context.Context, machineType ec2types.InstanceType) (*MachineTypeInfo, error) {
clients.mutex.Lock()
defer clients.mutex.Unlock()
if info, ok := clients.machineTypes[machineType]; ok {
return info, nil
}
resp, err := clients.ec2.DescribeInstanceTypes(ctx, &ec2.DescribeInstanceTypesInput{
InstanceTypes: []ec2types.InstanceType{machineType},
})
if err != nil {
return nil, fmt.Errorf("describing instance type %q in region %q: %w", machineType, c.region, err)
}
if len(resp.InstanceTypes) != 1 {
return nil, fmt.Errorf("instance type %q not found in region %q", machineType, c.region)
}
info := resp.InstanceTypes[0]
machine := &MachineTypeInfo{
GPU: info.GpuInfo != nil,
InstanceENIs: aws.ToInt32(info.NetworkInfo.MaximumNetworkInterfaces),
InstanceIPsPerENI: aws.ToInt32(info.NetworkInfo.Ipv4AddressesPerInterface),
}
if clients.machineTypes == nil {
clients.machineTypes = make(map[ec2types.InstanceType]*MachineTypeInfo)
}
clients.machineTypes[machineType] = machine
return machine, nil
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Run 'aws ec2 describe-instance-types --instance-types <type> --region <region>' to confirm AWS offers the type in that region
- Fix the machineType field in the kops instance group / cluster spec (check spelling, e.g. t2 vs t3, m5 vs m5a)
- Pick an equivalent instance type that is available in the region (aws ec2 describe-instance-types --region <region> to list options)
- If the type is genuinely correct but new, upgrade kops to a version whose EC2 SDK supports it
Example fix
// before (instancegroup spec) machineType: m5xn.large // after machineType: m5.xlarge
Defensive patterns
Strategy: validation
Validate before calling
// Verify the type exists in the region before provisioning
out, err := exec.Command("aws", "ec2", "describe-instance-types",
"--region", region, "--instance-types", machineType).Output()
if err != nil || len(out) == 0 {
return fmt.Errorf("instance type %s not available in %s", machineType, region)
} Type guard
func isKnownInstanceType(t string) bool {
valid := []string{"t3.medium", "m5.large", "m5.xlarge", "c5.xlarge"}
for _, v := range valid {
if v == t { return true }
}
return false
} Try / catch
info, err := cloud.GetMachineTypeInfo(ctx, machineType)
if err != nil {
if strings.Contains(err.Error(), "not found in region") {
return fmt.Errorf("machineType %q unavailable in region %q; pick a supported type", machineType, region)
}
return err // transient AWS error; retry instead
} Prevention
- Cross-check instance group machineType against AWS regional availability before 'kops create'
- Pin instance types to types supported in all regions you deploy to
- Watch AWS deprecation notices and update specs before types are retired
When it happens
Trigger: Calling GetMachineTypeInfo (from nodeup's Run) with an instance type that DescribeInstanceTypes matches zero entries for: a misspelled type name (e.g. m5.large vs m5a.large), a type not available in the cluster's region, a deprecated/retired type, or an empty InstanceType value in the instance group spec.
Common situations: Typo in kops instance group machineType; launching a newer instance family on an old kOps region config; using a type unavailable in the chosen Availability Zone/region (e.g. m7i in a region that hasn't launched it); retired types like m3.medium after AWS deprecation.
Related errors
- instance type %q not found in region %q
- error Zone is not a recognized AZ: %q (check you have specif
- could not find a suitable supported instance type for the in
- error checking if instance type %q is supported in region %q
- describing instance type %q in region %q: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/9c1060f2c56388cd.
Report an issue: GitHub.