The Vantage Query Language (VQL) is a SQL-like language for filtering cloud cost data. It includes a normalized schema across cloud providers and basic filter syntax for creating complex filters. VQL is currently available as part of the Vantage API as well as within the Vantage Terraform provider.
On Cost, Resource, and Kubernetes Efficiency Reports, you can create a filter and click View as VQL to see the filter represented in VQL.
- API. On supported endpoints, such as
/cost_reports
and /resource_reports
, you can use VQL in the filter
parameter to programmatically create and fetch Cost Reports.
- Terraform provider. In supported Terraform resources, such as
vantage_saved_filter
or vantage_cost_report
, you can use VQL for the filter
argument to create filtered Cost Reports or saved filters.
The below examples show how to use VQL on both the API and the Terraform provider. This example creates a saved filter in your Vantage account using VQL.
curl --request POST \
--url https://api.vantage.sh/v2/saved_filters \
--header 'content-type: application/json' \
--header 'authorization: Bearer <ACCESS_TOKEN>' \
--data @- <<EOF
{
"filter": "(costs.provider = 'aws' AND costs.service = 'Amazon Relational Database Service') OR (costs.provider = 'kubernetes')",
"title": "RDS and Kubernetes",
"workspace_token": "wrkspc_abcde12345"
}
EOF
Key Concepts
VQL is based on the following key concepts, further described in subsequent sections.
VQL uses a schema that organizes filters into namespaces. These namespaces comprise various fields that you can leverage to filter and retrieve specific cost-related data.
Scopes
VQL has a separate scope for each type of report—meaning that you cannot use VQL statements for Cost Reports when querying Resource Reports. See the following pages below to learn more about each VQL scope.