Contributions are currently paused.
For a reference of a properly constructed query please reference the Examples below:
SELECT SECTION RULES:
It is recommended to sanitize the query of your account and resource related data. Be advised, during the review process, queries submitted with customer account data will be sanitized.
To fill fields with dummy data, use the following select statement (example shown fills bill_payer_account_id with dummy data):
'111122223333' AS bill_payer_account_id
'444455556666' AS line_item_usage_account_id
For line_item_resource_id there is not a reference to all resources in the safenames document. Where possible use:
‘<resource id>' AS line_item_resource_id
COLUMN NAMING:
If a column requires a specific name to be defined ( i.e. after running a sum function ), use the name of the outer most function followed by the column name:
SUM(CAST(line_item_usage_amount AS DOUBLE)) AS sum_line_item_usage_amount,
SUM(CAST(line_item_usage_amount AS DOUBLE)) AS sum_line_item_usage_amount,
SPLIT_PART(line_item_resource_id, 'crawler/', 2) AS split_line_item_resource_id,
SPLIT_PART(line_item_usage_type ,':',2) AS split_line_item_usage_type
For DATE_FORMAT use the value defined by the format:
DATE_FORMAT(line_item_usage_start_date,'%Y-%m') AS month_line_item_usage_start_date,
DATE_FORMAT(line_item_usage_start_date,'%Y-%m-%d') AS day_line_item_usage_start_date,
If multiple nested functions are used, use the name of the left-most function only followed by the column name:
TRIM(REPLACE(product_group, 'Security Services - Amazon GuardDuty ', '')) AS trim_product_group,
FROM SECTION RULES:
Use ${table_name} as the variable for the customer table name.
WHERE SECTION RULES:
To aggregate data, always try to use the default CUR partitions as defined by the CUR CFN template. The data is partitioned on year and month. Below is an example on how we are formatting this WHERE statement:
${date_filter}
For month we use both ‘mm' vs. ‘m' as per the example above as previous CFN templates have included both formats.
ORDER BY SECTION RULES:
Order is currently at authors discretion. You can use the selected data including your functions used in your select, a column alias, or you can substitute with a column number. It is most readable if you use column aliases in the SELECT and ORDER BY clauses.
${table_name}
${payer_id}
OTHER:
We have split the CUR queries up into folders matching the AWS Cloud Product groups. This is to enable users to easily find the query they are looking for based on the service they are interested in.
When adding a query please consider these points: