hi team need attributeFilters key name to find ama...
# help
a
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
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
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
@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
Yes URL=
<https://pricing.api.infracost.io/graphql>
HEADER=
Copy code
{
  "X-Api-Key": "<API_KEY>",
  "content-type": "application/json"
}
Present PAYLOAD=
Copy code
{"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:
Copy code
{key: "volumeApiName", value: "gp3"},
Along with this we intend to add IOPS, Throughput and size for EBS also.
a
Bs sorted abb
l
@prehistoric-airport-41434 you’ll need to use the
Storage
productFamily, e.g:
Copy code
query {
  products(filter: {
    vendorName: "aws",
    service: "AmazonEC2"
    region: "us-east-1"
    productFamily: "Storage"
    attributeFilters: [
      {key: "volumeApiName", value: "gp3"}
    ]
  }) {
    attributes {
      key, value
    }
    prices {
      USD
    }
  }
}
p
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
Copy code
{'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
@prehistoric-airport-41434 here are some queries for IOPS and throughput. IOPS:
Copy code
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:
Copy code
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
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
@prehistoric-airport-41434 you can batch them into a single query:
Copy code
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
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:
Copy code
'{ 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:
Copy code
"<https://pricing.api.infracost.io/graphql>"
l
@prehistoric-airport-41434 could it be that that instance type isn’t supported in af-south-1?
p
Just Checked it. It isn't available in af-south-1. Thanks!