If you need help constructing a VQL query, navigate to the Financial Commitment Reports page and click New Report. From the top left, open the Filters menu. Create a filter and click the View as VQL button at the top of the Filters menu to see a filter’s VQL representation. You can copy this syntax to use within your API calls.
Financial Commitment Reports VQL Schema
VQL for Financial Commitment Reports comprises one namespace,financial_commitments
, which represents the available filters on Financial Commitment Reports in the Vantage console. To reference a filter, use the following syntax: namespace.field
(e.g., financial_commitments.service
). The following fields are available within the financial_commitments
namespace.
Namespace | Field | VQL Example |
---|---|---|
financial_commitments | provider | provider = 'aws' should be added as the first part of each statement |
financial_commitments | service | Service example |
financial_commitments | resource_account_id | Account example |
financial_commitments | provider_account_id | Billing Account example |
financial_commitments | commitment_type | Commitment Type example |
financial_commitments | commitment_id | Commitment ARN example |
financial_commitments | cost_type | Charge Type example |
financial_commitments | cost_category | Category example |
financial_commitments | cost_sub_category | Subcategory example |
financial_commitments | instance_type | Instance Type example |
financial_commitments | Region | Region example |
financial_commitments | resource_tags | Tags example |
Keywords
VQL includes a set of keywords to create complex filter conditions. These keywords function similar to their SQL equivalents. Note that each expression started withprovider = 'aws'
, followed by additional filters.
Keyword | Description | VQL Sample | Explanation |
---|---|---|---|
AND | Logical AND operator | (financial_commitments.provider = 'aws' AND (financial_commitments.resource_tags->>'business-metric' = 'us-east-1a') AND (financial_commitments.cost_category = 'Alarm')) | This example filters for a specific tag and category, where both conditions must be true. |
OR | Logical OR operator | (financial_commitments.provider = 'aws' AND (financial_commitments.resource_tags->>'business-metric' = 'us-east-1a') AND (financial_commitments.resource_tags->>'business-metric' = 'us-east-1b')) | This example looks for results associated with two different tags. At least one condition must be true. |
!= | Is not | (financial_commitments.provider = 'aws' AND (financial_commitments.cost_type != 'Credit')) | This example looks for results that are any charge type except for Credit . |
IN and NOT IN | Used to compare against an array/list | (financial_commitments.provider = 'aws' AND (financial_commitments.resource_tags->>'business-metric' IN ('us-east-1a','us-east-1b','us-east-1c'))) | This example searches for results with the business-metric tag key and multiple values. This same query also works for NOT IN where the results are anything matching the tag key except for those particular values: (financial_commitments.provider = 'aws' AND (financial_commitments.resource_tags->>'business-metric' NOT IN ('us-east-1a','us-east-1b','us-east-1c'))) . |
LIKE and NOT LIKE | Performs string comparisons | (financial_commitments.provider = 'aws' AND (financial_commitments.commitment_id LIKE '%arn:aws:ec2%')) | This example selects data where the commitment ARN value contains arn:aws:ec2 , such as arn:aws:ec2:us-west-2:1234 . This same query also works for NOT LIKE where data does not contain a particular string: (financial_commitments.provider = 'aws' AND (financial_commitments.commitment_id NOT LIKE '%arn:aws:ec2%')) . |
->> | This operator is used only when constructing queries related to tags | (financial_commitments.provider = 'aws' AND (financial_commitments.resource_tags->>'environment' = 'staging')) | This example looks results with the tag name of environment and value of staging . |
VQL Examples
The following examples cover common use cases for VQL.Financial Commitments by Service
Filter for multiple services.Financial Commitments by Specific Account
Filter down to an individual account.Financial Commitments by Specific Billing Account
Filter down to an individual billing account.See Specific Commitment Types
Filter out certain commitment types to see everything else.Financial Commitments by Commitment ARN
See the impact of specific financial commitments related to EC2 by ARNs.Financial Commitments by Charge Type
See only usage-related commitments.Financial Commitments by Category
All data transfer-related commitments.Financial Commitments by Subcategory
Filter for Cloudfront and data transfer egress in APN2.Financial Commitments by Instance Types
Filter from a list of different instance types.Financial Commitments by Region
See all financial commitments outside ofus-east-1
.
Financial Commitments by Tags
Filter based on a specific tag calledbusiness-metric
and a list of provided values.
Multiple Filters
Complex filter that shows combining two different statements usingOR
with multiple criteria.