This message was deleted.
# help
b
This message was deleted.
l
@able-pencil-95187 there’s not an easy way yet to go from the Infracost CLI to the raw pricing API calls. At the moment, you really have to look through the code for each resource and look at the values we pass. Here’s an example of the EC2 compute values in the code which would map to the a GraphQL query like the following:
Copy code
query {
  compute: products(filter: {
    vendorName: "aws",
    service: "AmazonEC2"
    region: "us-east-1"
    productFamily: "Compute Instance"
    attributeFilters: [
      {key: "instanceType", value: "t2.micro"}
      {key: "tenancy", value: "Shared"}
      {key: "operatingSystem", value: "Linux"}
      {key: "preInstalledSw", value: "NA"}
      {key: "licenseModel", value: "No License required"}
      {key: "capacitystatus", value: "Used"}
    ]
  }) {
    attributes {
      key, value
    }
    prices(filter: {
      purchaseOption: "on_demand"
    }) {
      USD
    }
  }
}
There’s also some docs here with an example request.
a
look through the code for each resource and look at the values we pass
@little-author-61621 can you link the directory for the resources? I might be able to extrapolate a lot
so the simple EC2 example I pasted will become constructed into the above gql query?
l
https://github.com/infracost/infracost/tree/master/internal/resources That example I pasted is just the EC2 compute cost, but depending on what you need, you might also need other costs (root volume storage/IOPS, compute credits, EBS optimized costs). These are also in that same resource file.