Query for costs in a Vantage Account. These are independent of a cost reports. Use Vantage VQL to structure a query. Queries must be scoped to a Workspace. Use the get-myself tool to know about available workspaces, and the list-cost-integrations tool to know about available cost providers. If the user didn't tell you a workspace it is best to ask them than to guess it. It's best to set a date range of 30 days unless the user specifically wants to query for a longer time period. When a user asks for data from an account, use the "get-cost-provider-accounts" tool to match a name to an account. With that result, always use the account_id in the account_id parameter for this tool. Here is some more detailed info on using VQL: All costs originate from a Cost Provider (generally a cloud company like AWS, Azure, Datadog) and then filter on a service that they provide (like EC2, S3, etc). A cost provider is required on every VQL query. VQL is always in parenthesis. Always use single quotes around names that are being queried. To query on a cost provider, use this syntax: (costs.provider = '<provider name>'). The provider name must come from the list-cost-providers tool. To query on a cost service, use this syntax: (costs.provider = '<provider name>' AND costs.service = '<service name>'). For AWS, costs.service must be a CUR identifier (e.g. 'AmazonEC2', 'AmazonVPC', 'AWSDirectConnect'). Resolve aliases from service values returned by a broad query-costs probe, not display names from list-cost-services. If a query returns no rows, run one broad probe query first (provider only, date_bin=month, wide date range) to learn available months and service identifiers before retrying with a narrower filter. For month-over-month comparisons, span both months in start_date/end_date with date_bin=month and settings_show_previous_period=true instead of separate queries per month. Prefer one query-costs call with all needed groupings (e.g. service, account_id, tag:<key>) over multiple calls that only change groupings. You can only filter against one cost provider at a time. If you want to query for costs from two providers, you need to use the OR operator. Example: ((costs.provider = 'aws') OR (costs.provider = 'azure')) You can otherwise use the IN system to compare against a list of items, like this: (costs.provider = 'aws' AND costs.service IN ('AWSQueueService', 'AWSLambda')) To filter within a cost provider, keep the cost provider part and add a AND section, example: (costs.provider = 'aws' AND costs.service = 'AmazonRDS') Many costs have tags on them. A tag is a "name" and one or more values. To find an AWS cost that has a tag of "environment" the value "production", use this syntax: (costs.provider = 'aws' AND tags.name = 'environment' AND tags.value = 'production') You can also query for any value of the "environment" tag, like this: (costs.provider = 'aws' AND tags.name = 'environment') Items without a tag can also be filtered, example: (costs.provider = 'aws' AND tags.name = NULL) Parenthesis can be nested. Here we surround an OR clause to look for either of two values for a tag: (costs.provider = 'aws' AND tags.name = 'environment' AND (tags.value = 'dev' OR tags.value = 'staging')) A user can have more than one provider account. They can filter on provider accounts if they supply you with the account id. Example: (costs.provider = 'aws' AND costs.account_id = '1000000717') You can also combine top-level queries to find for two providers: ((costs.provider = 'datadog') OR (costs.provider = 'azure')) Some cost providers operate in a specific region, you can filter using the costs.region field. Example: (costs.provider = 'aws' AND costs.region = 'us-east-1') Note that when users want to query a Custom Provider, that has a special case. When doing a VQL query for custom provider, use the 'token' you get back from the 'list-cost-integrations' tool. Here is an example, where the token of the custom provider is "accss_crdntl_07171984": (costs.provider = 'custom_provider:accss_crdntl_07171984') The DateBin parameter controls the time granularity of returned results. When DateBin=day you get a record for each service spend on that day. For DateBin=week you get one entry per week, with the accrued_at field set to the first day of the week, but the spend item represents spend for a full week. Same with DateBin=month, each record returned covers a month of data. This lets you get answers with processing fewer records. If omitted, DateBin defaults to day. Cost settings (credits, refunds, discounts, tax, amortization, etc.) default to the workspace's default report settings. Only provide these parameters if you need to override those defaults. Use settings_aggregate_by to choose the metric: cost (default), usage, or count. When aggregate_by is count, the response includes total_count and counts (date-binned distinct Group By permutation counts for the full requested period).
Parameters
A VQL query to run against your vantage account
Workspace token (`wrkspc_*`).
Date binning for returned costs. Defaults to day if omitted. Allowed values: day, week, month. One of: `day`, `week`, `month`.
End date to filter costs by, format=YYYY-MM-DD
Group the results by specific field(s). Defaults to provider, service, region. Valid groupings: account_id, billing_account_id, charge_type, cost_category, cost_subcategory, provider, region, resource_id, service, tagged, usage_unit, tag:<tag_value>. Include every grouping you need in one call rather than issuing separate calls per grouping.
The page number to return, defaults to 1. Default: `1`.
Results will aggregate by cost, usage, or count. If not provided, the workspace's default report setting is used. One of: `cost`, `usage`, `count`.
Results will amortize. If not provided, the workspace's default report setting is used.
Results will include credits. If not provided, the workspace's default report setting is used.
settings_include_discounts
Results will include discounts. If not provided, the workspace's default report setting is used.
Results will include refunds. If not provided, the workspace's default report setting is used.
Results will include tax. If not provided, the workspace's default report setting is used.
settings_show_previous_period
Results will show previous period cost, usage, or count comparison. If not provided, the workspace's default report setting is used.
Results will show unallocated costs. If not provided, the workspace's default report setting is used.
Sort results by one of the fields in groupings. Valid groupings: account_id, billing_account_id, charge_type, cost_category, cost_subcategory, provider, region, resource_id, service, tagged, usage_unit, tag:<tag_value>. Defaults to sorting by date.
Grouping sort direction. Defaults to asc when sort_column is supplied; requires sort_column. One of: `asc`, `desc`.
Start date to filter costs by, format=YYYY-MM-DD