{"record":{"id":"85ab4b35a796cc40","repo":"kubernetes/kops","slug":"failed-to-build-ephemeral-devices-w","errorCode":null,"errorMessage":"failed to build ephemeral devices: %w","messagePattern":"failed to build ephemeral devices: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/launchtemplate_target_api.go","lineNumber":72,"sourceCode":"\t\t},\n\t\tNetworkInterfaces: []ec2types.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{\n\t\t\t{\n\t\t\t\tAssociatePublicIpAddress: t.AssociatePublicIP,\n\t\t\t\tDeleteOnTermination:      aws.Bool(true),\n\t\t\t\tDeviceIndex:              new(int32(0)),\n\t\t\t\tIpv6AddressCount:         t.IPv6AddressCount,\n\t\t\t},\n\t\t},\n\t}\n\n\t// @step: add the actual block device mappings\n\trootDevices, err := t.buildRootDevice(c.Cloud)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to build root device: %w\", err)\n\t}\n\tephemeralDevices, err := buildEphemeralDevices(c.Cloud, fi.ValueOf(t.InstanceType))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to build ephemeral devices: %w\", err)\n\t}\n\tadditionalDevices, err := buildAdditionalDevices(t.BlockDeviceMappings)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, x := range []map[string]*BlockDeviceMapping{rootDevices, ephemeralDevices, additionalDevices} {\n\t\tfor name, device := range x {\n\t\t\tdata.BlockDeviceMappings = append(data.BlockDeviceMappings, device.ToLaunchTemplateBootDeviceRequest(name))\n\t\t}\n\t}\n\n\t// @step: add the ssh key\n\tif t.SSHKey != nil {\n\t\tdata.KeyName = t.SSHKey.Name\n\t}\n\t// @step: add the security groups\n\tfor _, sg := range t.SecurityGroups {\n\t\tdata.NetworkInterfaces[0].Groups = append(data.NetworkInterfaces[0].Groups, fi.ValueOf(sg.ID))","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/launchtemplate_target_api.go#L54-L90","documentation":"RenderAWS builds ephemeral (instance-store) block device mappings for the instance type via buildEphemeralDevices(c.Cloud, instanceType). If that helper fails - typically because the instance type has no known ephemeral device layout - the error is wrapped as 'failed to build ephemeral devices'.","triggerScenarios":"RenderAWS on a launchtemplate task where buildEphemeralDevices errors for the given t.InstanceType - e.g. an unknown/unsupported instance type name passed to the device-count lookup.","commonSituations":"Typo'd or newly released instance type not yet in kOps' instance-type table; requesting ephemeral devices on an EBS-only instance type family; upstream machine type metadata missing the type.","solutions":["Correct the instanceType in the InstanceGroup to a supported type.","Upgrade kops so its instance-type table knows newer instance types.","If the type is EBS-only and has no ephemeral stores, this usually returns an empty map rather than erroring - re-check the configured type for typos."],"exampleFix":"// before\nmachineType: m8g.xlarg  // typo / unknown\n// after\nmachineType: m8g.xlarge","handlingStrategy":"validation","validationCode":"// verify the instance type is a known, supported type before apply\naws ec2 describe-instance-types --instance-types $MACHINE_TYPE","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"failed to build ephemeral devices\") { correct machineType or upgrade kops for the new type, then re-apply }","preventionTips":["Type machineType exactly as AWS names it.","Upgrade kops when adopting newly released instance families.","Remember EBS-only families have no ephemeral devices - don't expect mappings for them."],"tags":["aws","launch-template","ephemeral-storage","instance-type"],"backgroundTag":"ephemeral-device-build-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}