[general] namespace = "CUR" [athena] database_name = 'cur' table_prefix = "autocur" create_database = "create database if not exists `cur` comment \"AutoDBR Athena Database\"" create_table = """ create external table if not exists `**DBNAME**.**PREFIX**_**DATE**` ( **COLUMNS** ) STORED AS PARQUET LOCATION '**S3**' \ """ [ri] enableRIanalysis = false enableRITotalUtilization = true # Set this to true to get a total RI percentage utilization value. riPercentageThreshold = 5 # Ignore un-used RI's where percentage of under-use lower than this value riTotalThreshold = 5 # Ignore un-used RI's where total number of RI's (per instance type) is below this. cwNameTotal = "riTotalUtilization" cwName = "riUnderUtilization" cwDimension = "instance" cwDimensionTotal = "total" cwType = "Percent" sql = "" [ri.ignore] ## Ignore un-used RI's in this map/hash "t2.micro" = 1 [metricConfig] [metricConfig.substring] "hourly" = "13" "daily" = "10" [[metrics]] ## Count of Instance purchase types (RI, Spot, onDemand)" enabled = false hourly = true daily = true type = "dimension-per-row" cwName = "InstancePurchaseType" cwDimension = "type" cwType = "Count" sql = """ SELECT coalesce(nullif("pricing/term", ''), substr(split_part("lineitem/usagetype", ':', 1), strpos("lineitem/usagetype", '-')+1)) as dimension, substr("lineitem/usagestartdate",1,**INTERVAL**) as date, sum("lineitem/usageamount") as value FROM **DBNAME**.autocur_**DATE** WHERE length("lineitem/usagestartdate") > 1 AND date(from_iso8601_timestamp("lineitem/usagestartdate")) >= date(now()) - interval '2' day AND from_iso8601_timestamp("lineitem/usagestartdate") < now() AND "product/productname" = 'Amazon Elastic Compute Cloud' AND "lineitem/operation" like 'RunInstances%' AND "lineitem/resourceid" like 'i-%' AND "lineitem/usagetype" like '%Usage%' GROUP BY coalesce(nullif("pricing/term", ''), substr(split_part("lineitem/usagetype", ':', 1), strpos("lineitem/usagetype", '-')+1)), substr("lineitem/usagestartdate",1,**INTERVAL**) ORDER BY substr("lineitem/usagestartdate",1,**INTERVAL**) DESC """ [[metrics]] ## Summary of Overall Cost per hour enabled = true hourly = true daily = true type = "dimension-per-row" cwName = "TotalCost" cwDimension = "cost" cwType = "None" sql = """ SELECT 'total' as dimension, substr("lineitem/usagestartdate",1,**INTERVAL**) as date, sum("lineitem/blendedcost") as value FROM **DBNAME**.autocur_**DATE** WHERE length("lineitem/usagestartdate") > 1 AND date(from_iso8601_timestamp("lineitem/usagestartdate")) >= date(now()) - interval '2' day AND from_iso8601_timestamp("lineitem/usagestartdate") < now() GROUP BY substr("lineitem/usagestartdate",1,**INTERVAL**) ORDER BY substr("lineitem/usagestartdate",1,**INTERVAL**) DESC\ """ [[metrics]] ## Summary of Cost per service per hour enabled = true hourly = true daily = true type = "dimension-per-row" cwName = "ServiceCost" cwDimension = "servicecost" cwType = "None" sql = """ SELECT "product/productname" as dimension, substr("lineitem/usagestartdate",1,**INTERVAL**) as date, sum("lineitem/blendedcost") as value FROM **DBNAME**.autocur_**DATE** WHERE length("lineitem/usagestartdate") > 1 AND date(from_iso8601_timestamp("lineitem/usagestartdate")) >= date(now()) - interval '2' day AND from_iso8601_timestamp("lineitem/usagestartdate") < now() GROUP BY "product/productname", substr("lineitem/usagestartdate",1,**INTERVAL**) HAVING sum("lineitem/blendedcost") > 0.1 ORDER BY substr("lineitem/usagestartdate",1,**INTERVAL**) DESC \ """ [[metrics]] ## Cost per account enabled = true hourly = true daily = true type = "dimension-per-row" cwName = "AccountCost" cwDimension = "accountcost" cwType = "None" sql = """ SELECT "lineitem/usageaccountid" as dimension, substr("lineitem/usagestartdate",1,**INTERVAL**) as date, sum("lineitem/blendedcost") as value FROM **DBNAME**.autocur_**DATE** WHERE length("lineitem/usagestartdate") > 1 AND date(from_iso8601_timestamp("lineitem/usagestartdate")) >= date(now()) - interval '2' day AND from_iso8601_timestamp("lineitem/usagestartdate") < now() GROUP BY "lineitem/usageaccountid", substr("lineitem/usagestartdate",1,**INTERVAL**) ORDER BY substr("lineitem/usagestartdate",1,**INTERVAL**) DESC \ """ [[metrics]] ## Count of Instance Types enabled = true hourly = true daily = false type = "dimension-per-row" cwName = "InstanceType" cwDimension = "instancecount" cwType = "Count" sql = """ SELECT split_part("lineitem/usagetype", ':', 2) as dimension, substr("lineitem/usagestartdate",1,**INTERVAL**) as date, sum("lineitem/usageamount") as value FROM **DBNAME**.autocur_**DATE** WHERE length("lineitem/usagestartdate") > 1 AND date(from_iso8601_timestamp("lineitem/usagestartdate")) >= date(now()) - interval '2' day AND from_iso8601_timestamp("lineitem/usagestartdate") < now() AND "product/productname" = 'Amazon Elastic Compute Cloud' AND "lineitem/operation" like 'RunInstances%' AND "lineitem/resourceid" like 'i-%' AND "lineitem/usagetype" like '%Usage%' GROUP BY split_part("lineitem/usagetype", ':', 2), substr("lineitem/usagestartdate",1,**INTERVAL**) HAVING sum("lineitem/usageamount") > 0.1 ORDER BY substr("lineitem/usagestartdate",1,**INTERVAL**) DESC \ """