https://infracost.io logo
#general
Title
# general
p

proud-summer-5262

05/22/2023, 5:50 PM
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

little-author-61621

05/22/2023, 6:30 PM
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

proud-summer-5262

05/23/2023, 1:34 AM
@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

little-author-61621

05/23/2023, 7:23 AM
@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 } } }
10 Views