{"record":{"id":"9c1060f2c56388cd","repo":"kubernetes/kops","slug":"instance-type-q-not-found-in-region-q-9c1060","errorCode":null,"errorMessage":"instance type %q not found in region %q","messagePattern":"instance type %q not found in region %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/awsup/machine_types.go","lineNumber":51,"sourceCode":"}\n\n// GetMachineTypeInfo calls ec2.DescribeInstanceTypes to get information for a particular instance type, caching the result.\nfunc (c *Cloud) GetMachineTypeInfo(ctx context.Context, machineType ec2types.InstanceType) (*MachineTypeInfo, error) {\n\tclients.mutex.Lock()\n\tdefer clients.mutex.Unlock()\n\n\tif info, ok := clients.machineTypes[machineType]; ok {\n\t\treturn info, nil\n\t}\n\n\tresp, err := clients.ec2.DescribeInstanceTypes(ctx, &ec2.DescribeInstanceTypesInput{\n\t\tInstanceTypes: []ec2types.InstanceType{machineType},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"describing instance type %q in region %q: %w\", machineType, c.region, err)\n\t}\n\tif len(resp.InstanceTypes) != 1 {\n\t\treturn nil, fmt.Errorf(\"instance type %q not found in region %q\", machineType, c.region)\n\t}\n\tinfo := resp.InstanceTypes[0]\n\n\tmachine := &MachineTypeInfo{\n\t\tGPU:               info.GpuInfo != nil,\n\t\tInstanceENIs:      aws.ToInt32(info.NetworkInfo.MaximumNetworkInterfaces),\n\t\tInstanceIPsPerENI: aws.ToInt32(info.NetworkInfo.Ipv4AddressesPerInterface),\n\t}\n\n\tif clients.machineTypes == nil {\n\t\tclients.machineTypes = make(map[ec2types.InstanceType]*MachineTypeInfo)\n\t}\n\tclients.machineTypes[machineType] = machine\n\n\treturn machine, nil\n}\n","sourceCodeStart":33,"sourceCodeEnd":68,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/awsup/machine_types.go#L33-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (instancegroup spec)\nmachineType: m5xn.large\n// after\nmachineType: m5.xlarge","handlingStrategy":"validation","validationCode":"// Verify the type exists in the region before provisioning\nout, err := exec.Command(\"aws\", \"ec2\", \"describe-instance-types\",\n  \"--region\", region, \"--instance-types\", machineType).Output()\nif err != nil || len(out) == 0 {\n  return fmt.Errorf(\"instance type %s not available in %s\", machineType, region)\n}","typeGuard":"func isKnownInstanceType(t string) bool {\n  valid := []string{\"t3.medium\", \"m5.large\", \"m5.xlarge\", \"c5.xlarge\"}\n  for _, v := range valid {\n    if v == t { return true }\n  }\n  return false\n}","tryCatchPattern":"info, err := cloud.GetMachineTypeInfo(ctx, machineType)\nif err != nil {\n  if strings.Contains(err.Error(), \"not found in region\") {\n    return fmt.Errorf(\"machineType %q unavailable in region %q; pick a supported type\", machineType, region)\n  }\n  return err // transient AWS error; retry instead\n}","preventionTips":["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"],"tags":["aws","ec2","instance-type","validation"],"backgroundTag":"aws-instance-type-not-found","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}