https://infracost.io logo
Title
a

acoustic-easter-27534

01/04/2023, 11:00 AM
hi team need attributeFilters key name to find amazon ebs storage price.Able to find spot and on_demand price for EC2 but for total cost need this EBS storage price also. can someone help me in this.. Thanks in advance.
l

little-author-61621

01/04/2023, 11:39 AM
Hi @acoustic-easter-27534 what filters do you have so far? It looks like we use
volumeApiName
to find the storage costs (https://github.com/infracost/infracost/blob/master/internal/resources/aws/ebs_volume.go#L106)
p

prehistoric-airport-41434

03/01/2023, 6:57 PM
Hey @little-author-61621. Had same doubt as @acoustic-easter-27534. Tried using
gp2
as value for key
volumeApiName
but seems to have given wrong value. Extra configurations includes IOPS, Throughput and size for EBS in our scenario. Could You help with this case?
l

little-author-61621

03/01/2023, 8:58 PM
@prehistoric-airport-41434 is this hitting the Cloud Pricing API directly? If so, do you have a curl command or a request that can reproduce this?
p

prehistoric-airport-41434

03/02/2023, 4:57 AM
Yes URL=
<https://pricing.api.infracost.io/graphql>
HEADER=
{
  "X-Api-Key": "<API_KEY>",
  "content-type": "application/json"
}
Present PAYLOAD=
{"query": "{ products(filter: {vendorName: "aws", service: "AmazonEC2", region: "us-east-1", attributeFilters: [
                {key: "instanceType", value: <instance_type>},
                {key: "preInstalledSw", value: "NA"},
                {key: "tenancy", value: "Shared"},
            ]
        }) { prices(filter: {purchaseOption: <"spot"/"ondemand">
            }) { USD
            }
        }
    } "
}
We intend to add in attributeFilters:
{key: "volumeApiName", value: "gp3"},
Along with this we intend to add IOPS, Throughput and size for EBS also.
a

acoustic-easter-27534

03/02/2023, 5:05 AM
Bs sorted abb
l

little-author-61621

03/02/2023, 3:24 PM
@prehistoric-airport-41434 you’ll need to use the
Storage
productFamily, e.g:
query {
  products(filter: {
    vendorName: "aws",
    service: "AmazonEC2"
    region: "us-east-1"
    productFamily: "Storage"
    attributeFilters: [
      {key: "volumeApiName", value: "gp3"}
    ]
  }) {
    attributes {
      key, value
    }
    prices {
      USD
    }
  }
}
p

prehistoric-airport-41434

03/03/2023, 3:29 AM
Thanks @little-author-61621. I am able to get Storage Cost. But is their any way we could get IOPS Cost and throughput Cost for the same? This is my response json
{'data': {'products': [{'attributes': [{'key': 'location', 'value': 'US East (N. Virginia)'}, {'key': 'operation', 'value': ''}, {'key': 'usagetype', 'value': 'EBS:VolumeUsage.gp3'}, {'key': 'regionCode', 'value': 'us-east-1'}, {'key': 'volumeType', 'value': 'General Purpose'}, {'key': 'servicecode', 'value': 'AmazonEC2'}, {'key': 'servicename', 'value': 'Amazon Elastic Compute Cloud'}, {'key': 'locationType', 'value': 'AWS Region'}, {'key': 'storageMedia', 'value': 'SSD-backed'}, {'key': 'maxIopsvolume', 'value': '16000'}, {'key': 'maxVolumeSize', 'value': '16 TiB'}, {'key': 'volumeApiName', 'value': 'gp3'}, {'key': 'maxThroughputvolume', 'value': '1000 MiB/s'}], 'prices': [{'USD': '0.0800000000'}]}]}}
l

little-author-61621

03/03/2023, 10:30 AM
@prehistoric-airport-41434 here are some queries for IOPS and throughput. IOPS:
query {
  products(filter: {
    vendorName: "aws",
    service: "AmazonEC2"
    region: "us-east-1"
    productFamily: "System Operation"
    attributeFilters: [
      {key: "volumeApiName", value: "gp3"}
      {key: "groupDescription", value: "IOPS"}
    ]
  }) {
    attributes {
      key, value
    }
    prices {
      USD
    }
  }
}
Throughput:
query {
  products(filter: {
    vendorName: "aws",
    service: "AmazonEC2"
    region: "us-east-1"
    productFamily: "Provisioned Throughput"
    attributeFilters: [
      {key: "volumeApiName", value: "gp3"},
    ]
  }) {
    attributes {
      key, value
    }
    prices {
      USD
    }
  }
}
p

prehistoric-airport-41434

03/03/2023, 10:47 AM
Great . This will be helpful @little-author-61621 .But Is their any way to query for Storage Cost, IOPS Cost , throughput Cost in single query?
l

little-author-61621

03/03/2023, 10:52 AM
@prehistoric-airport-41434 you can batch them into a single query:
query {
  storage: products(filter: {
    vendorName: "aws",
    service: "AmazonEC2"
    region: "us-east-1"
    productFamily: "Storage"
    attributeFilters: [
      {key: "volumeApiName", value: "gp3"}
    ]
  }) {
    attributes {
      key, value
    }
    prices {
      USD
    }
  },
  iops: products(filter: {
    vendorName: "aws",
    service: "AmazonEC2"
    region: "us-east-1"
    productFamily: "System Operation"
    attributeFilters: [
      {key: "volumeApiName", value: "gp3"},
      {key: "groupDescription", value: "IOPS"}
    ]
  }) {
    attributes {
      key, value
    }
    prices {
      USD
    }
  }
  throughput: products(filter: {
    vendorName: "aws",
    service: "AmazonEC2"
    region: "us-east-1"
    productFamily: "Provisioned Throughput"
    attributeFilters: [
      {key: "volumeApiName", value: "gp3"},
    ]
  }) {
    attributes {
      key, value
    }
    prices {
      USD
    }
  }
}
p

prehistoric-airport-41434

03/04/2023, 4:44 AM
Gotit. Thanks for the help @little-author-61621.This helps us a lot .
@little-author-61621 Could you help in resolving issue where I am unable get instance base cost for region
af-south-1
? Except this region, I am able to get cost for others. Query:
'{ products(filter: {vendorName: "aws", service: "AmazonEC2", region: "af-south-1", attributeFilters: [{key: "instanceType", value: "c6g.16xlarge"}, {key: "operatingSystem", value: "Linux"}, {key: "tenancy", value: "Shared"}, {key: "capacitystatus", value: "Used"}, {key: "preInstalledSw", value: "NA"}]}) { prices(filter: {purchaseOption: "on_demand"}) { USD } } } '}
URL:
"<https://pricing.api.infracost.io/graphql>"
l

little-author-61621

03/07/2023, 3:39 PM
@prehistoric-airport-41434 could it be that that instance type isn’t supported in af-south-1?
p

prehistoric-airport-41434

03/09/2023, 2:44 PM
Just Checked it. It isn't available in af-south-1. Thanks!