Hi Infracost Team, We are using Infracost graphql ...
# general
p
Hi Infracost Team, We are using Infracost graphql API to get the resource usage for our multi cloud usage. Usecase i am looking at is being fulfilled with the resource level, but curious how to find the ingress/egress data cost between/across cloud service providers(GCP,AWS, Azure). Is there a way to query the egress resource costing from the graphql?
l
Hi @proud-summer-5262, the Infracost CLI has some logic for querying the graphql API to get network costs, so maybe that could help work out the query parameters. Here are two parts of it that might be relevant: https://github.com/infracost/infracost/blob/master/internal/resources/aws/data_transfer.go#L248 https://github.com/infracost/infracost/blob/master/internal/resources/google/network_egress_internal.go#L236
p
@little-author-61621 Thank you for the prompt response. I did able to construct the query for the AWS, how ever i am getting huge set of objects per region level to region level mapping. I am trying to limit the response to specific regions or geo, but not able to filter it based on the following query.. Are there any examples how i can use the description_regex filter ? { products(filter: {vendorName: "aws", service: "AWSDataTransfer" }) { prices(filter: {purchaseOption: "on_demand", description_regex: "/"}) { USD, unit, description,priceHash } } } { "prices": [ { "USD": "0.0400000000", "unit": "GB", "description": "USD 0.04 per GB for EUN1-EUS1-AWS-In-ABytes in EU (Milan)", "termOfferingClass": null, "termLength": null, "effectiveDateEnd": null, "endUsageAmount": "Inf", "purchaseOption": "on_demand", "priceHash": "131e624ad95872cb9bc220606a10b06a-b1ae3861dc57e2db217fa83a7420374f" } ] },
l
@proud-summer-5262 something like this should work:
Copy code
{ products(filter: {vendorName: "aws", service: "AWSDataTransfer" }) { prices(filter: {purchaseOption: "on_demand", description_regex: "/(\Milan\)$/"}) { USD, unit, description,priceHash } } }