Hi all, the whole EC2 `.metal` SKU family is absen...
# help
n
Hi all, the whole EC2
.metal
SKU family is absent from the Cloud Pricing API. Could you add the bare-metal SKUs? Happy to file a GitHub issue if that's the better channel. Thanks!
1
a
Thanks for the report Stephanie. We'll take a look. Can you verify what region you are seeing this in?
n
Thanks! Seeing in us-east-1
a
Good news, the bare-metal SKUs are all there, but AWS classifies them under a separate
productFamily
from the rest of EC2, which I think is what's tripping the query up. Support for the metal family was added late last year. Specifically, AWS uses
productFamily: "Compute Instance"
for normal EC2 SKUs, but switches to
productFamily: "Compute Instance (bare metal)"
for every
.metal
type. The Cloud Pricing API mirrors AWS's classification exactly, so a query that filters on
"Compute Instance"
will come back empty for any
.metal
SKU. If you swap the
productFamily
filter, the data is all there. Quick sanity check in `us-east-1`:
Copy code
{
  products(filter: {
    vendorName: "aws",
    service: "AmazonEC2",
    productFamily: "Compute Instance (bare metal)",
    region: "us-east-1",
    attributeFilters: [
      { key: "instanceType", value: "m5.metal" },
      { key: "tenancy", value: "Shared" },
      { key: "operatingSystem", value: "Linux" },
      { key: "preInstalledSw", value: "NA" },
      { key: "capacitystatus", value: "Used" }
    ]
  }) {
    prices(filter: { purchaseOption: "on_demand" }) { USD }
  }
}
Returns $4.1472/hr for
m5.metal
. I just successfully spot-checked
m5.metal
,
i3.metal
,
c6i.metal
,
r5.metal
,
m7i.metal-48xl
, and
c8g.metal-48xl
. Worth noting: if you're going through the Infracost CLI rather than calling the API directly, the CLI already does this
productFamily
switch internally for
.metal
instance types, so it should "just work" there. Let me know if there's a specific instance type that's still missing after the switch, and we can dig in further. Thanks for flagging it! I'll also pass this on internally as a docs item, since it's an easy thing to get caught on.
n
Thank you, that makes sense on the API side! Quick question though: should this work through the CLI on the latest version? It's still returning $0 for me. On Infracost v2.5.2 with
infracost scan
(us-east-1, Linux/on-demand):
Copy code
provider "aws" { region = "us-east-1" }
resource "aws_instance" "metal"   {
  ami = "ami-1"; instance_type = "m5.metal" }
resource "aws_instance" "control" {
  ami = "ami-1"; instance_type = "m5.24xlarge" }
m5.24xlarge
comes back at $3,365/mo as expected, but
m5.metal
shows $1/mo (just the root volume). Same for the other
.metal
types. Am I missing a flag or config, or is the bare-metal handling maybe not in the
scan
path yet?
a
I noticed that in my testing as well, looks like a potential bug. Will let you know once we've completed the investigation.
n
Sounds good, thanks again 😁
a
This is now fixed @nutritious-printer-37048. Can you update your CLI and test again?
@nutritious-printer-37048 I'm going to close this ticket, if you have a chance or discover any additional issues, please let us know.