Hi folks! I have a small query about the Infracost...
# help
f
Hi folks! I have a small query about the Infracost API documentation on AWS Cost and Pricing. Can you please send me the clear documentation mentioning the request body params. This is the problem I've been facing:
{
"query": "{ products(filter: {vendorName: \"aws\", service: \"AmazonRDS\", region: \"ap-south-1\", attributeFilters: [{key: \"instanceType\", value: \"db.t2.micro\"},{key: \"deploymentOption\", value: \"Multi-AZ\"},*{key: \"engine\", value: \"mysql\"}*]}) { prices (filter: {purchaseOption: \"on_demand\"}) { USD} } } "
}
In the above request body to calculate the price of the RDS instance, the key value pair to specify the engine is causing problems. Without the parameter
{key: \"engine\", value: \"mysql\"}
I'm able to get the response. Is there any way to estimate the cost by specifying the engine type?
m
Hi @fancy-application-28950 the request params for
attributeFilters
are variable and correspond to the
attributes
we sync from the cloud providers. In your case the
engine
is not a valid key as this doesn’t appear as attribute that AWS provides. Instead it’s
databaseEngine
. So to get valid prices for your query you’d have to change your query to something like:
Copy code
{ products(filter: {vendorName: \"aws\", service: \"AmazonRDS\", region: \"ap-south-1\", attributeFilters: [{key: \"instanceType\", value: \"db.t2.small\"},{key: \"databaseEngine\", value: \"Aurora MySQL\"}]}) { prices (filter: {purchaseOption: \"on_demand\"}) { USD} } }
Note
databaseEngine
has been added,
deploymentOption
removed and
instanceType
changed to a type that is supported for
Aurora MySQL
. If you want to understand which attributes and filters you can use to query the pricing api, I’d recommend booting a local version of the cloud pricing api and introspecting the db for the information you require. Hope this helps
f
Yes! Thank you @mysterious-teacher-68276!