{"record":{"id":"976529fc52532380","repo":"kubernetes/kops","slug":"describing-instance-type-q-in-region-q-w","errorCode":null,"errorMessage":"describing instance type %q in region %q: %w","messagePattern":"describing instance type %q in region %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_cloud.go","lineNumber":2097,"sourceCode":"\tc.instanceTypes.mutex.Lock()\n\tdefer c.instanceTypes.mutex.Unlock()\n\n\tinfo, err := describeInstanceType(c, instanceType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.instanceTypes.typeMap[instanceType] = info\n\treturn info, nil\n}\n\nfunc describeInstanceType(c AWSCloud, instanceType string) (*ec2types.InstanceTypeInfo, error) {\n\tctx := context.TODO()\n\treq := &ec2.DescribeInstanceTypesInput{\n\t\tInstanceTypes: []ec2types.InstanceType{ec2types.InstanceType(instanceType)},\n\t}\n\tresp, err := c.EC2().DescribeInstanceTypes(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"describing instance type %q in region %q: %w\", instanceType, 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\", instanceType, c.Region())\n\t}\n\treturn &resp.InstanceTypes[0], nil\n}\n\n// AccountInfo returns the AWS account ID and AWS partition that we are deploying into\nfunc (c *awsCloudImplementation) AccountInfo(ctx context.Context) (string, string, error) {\n\trequest := &sts.GetCallerIdentityInput{}\n\n\tresponse, err := c.sts.GetCallerIdentity(ctx, request)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"error getting AWS account ID: %v\", err)\n\t}\n\n\tarn, err := arn.Parse(aws.ToString(response.Arn))\n\tif err != nil {","sourceCodeStart":2079,"sourceCodeEnd":2115,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_cloud.go#L2079-L2115","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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.","Check AWS credentials: run 'aws sts get-caller-identity' with the same profile/env kOps uses; refresh expired keys or fix AWS_PROFILE.","Confirm network reachability to ec2.<region>.amazonaws.com (proxy/VPN/firewall settings).","If the underlying error is throttling, retry with backoff or reduce concurrent kOps API calls.","Ensure the region in the kOps config supports the chosen instance type (newer types are region-gated)."],"exampleFix":"// before (cluster spec)\ninstanceType: t3.meduim\n// after\ninstanceType: t3.medium","handlingStrategy":"retry","validationCode":"// validate the instance type name client-side before calling kOps/EC2\nfunc validInstanceTypeName(name string) bool {\n\tif name == \"\" || strings.ToLower(name) != name { return false }\n\tparts := strings.SplitN(name, \".\", 2)\n\treturn len(parts) == 2 && parts[0] != \"\" && parts[1] != \"\"\n}\n// if err := awsProfileCheck(); err != nil { ... }  // 'aws sts get-caller-identity' as a preflight","typeGuard":"func isAWSSDKError(err error) (retryable bool) {\n\tvar rae interface{ ErrorCode() string }\n\tif errors.As(err, &rae) {\n\t\tswitch rae.ErrorCode() {\n\t\tcase \"RequestLimitExceeded\", \"ThrottlingException\", \"RequestTimeout\":\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}","tryCatchPattern":"_, err := DescribeInstanceType(name)\nif err != nil {\n\tvar apiErr smithy.APIError\n\tif errors.As(err, &apiErr) && (apiErr.ErrorCode() == \"RequestLimitExceeded\" || apiErr.ErrorCode() == \"ThrottlingException\") {\n\t\t// retry with exponential backoff\n\t} else {\n\t\treturn fmt.Errorf(\"instance type %s unusable: %w\", name, err)\n\t}\n}","preventionTips":["Preflight credentials with 'aws sts get-caller-identity' before running kOps.","Validate instance type names against 'aws ec2 describe-instance-types' for the target region during CI.","Keep instance type names lowercase and exactly matching AWS naming in the cluster spec.","Configure SDK retryer with backoff for throttling errors."],"tags":["aws","ec2","api-error","instance-type"],"backgroundTag":"aws-api-call-failed","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"}