Cloud Cost Report
Empathy Cloud Cost Report.
  The objective of the dashboard is to provide visualization of the the cloud costs of one of our cloud providers in the different accounts and departaments.
 
- Top 10 most expensive departments

- Cost of a department in each account

- Cost of services per department

- Invoice spend by department

- Invoice spend by account
Empathy Cloud Cost Report.
{
  "__inputs": [
    {
      "name": "DS_ATHENA_SHARED",
      "label": "Athena shared",
      "description": "",
      "type": "datasource",
      "pluginId": "grafana-athena-datasource",
      "pluginName": "Amazon Athena"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "panel",
      "id": "barchart",
      "name": "Bar chart",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.3.1"
    },
    {
      "type": "datasource",
      "id": "grafana-athena-datasource",
      "name": "Amazon Athena",
      "version": "1.0.3"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1647877380557,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "panels": [],
      "title": "Billing Summary",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-athena-datasource",
        "uid": "${DS_ATHENA_SHARED}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "match": "empty",
                "result": {
                  "index": 0,
                  "text": "Total"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 1000
              },
              {
                "color": "dark-orange",
                "value": 5000
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 4,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "allValues"
          ],
          "fields": "/.*/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "8.3.1",
      "targets": [
        {
          "connectionArgs": {
            "catalog": "__default",
            "database": "__default",
            "region": "__default"
          },
          "datasource": {
            "type": "grafana-athena-datasource",
            "uid": "${DS_ATHENA_SHARED}"
          },
          "format": 1,
          "rawSQL": "select \n  resource_tags_user_department as departments,\n  sum(line_item_blended_cost) as cost\nfrom $CUR_Table\nwhere\n  $__timeFilter(bill_billing_period_start_date)\ngroup by resource_tags_user_department\norder by cost DESC\nlimit 10",
          "refId": "A"
        }
      ],
      "title": "Top 10 Most Expensive Departments",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "grafana-athena-datasource",
        "uid": "${DS_ATHENA_SHARED}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "axisSoftMin": 0,
            "fillOpacity": 80,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 1000
              },
              {
                "color": "red",
                "value": 5000
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 9
      },
      "id": 6,
      "options": {
        "barWidth": 0.97,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "hidden",
          "placement": "bottom"
        },
        "orientation": "auto",
        "showValue": "always",
        "stacking": "none",
        "tooltip": {
          "mode": "single"
        },
        "xTickLabelRotation": 0
      },
      "pluginVersion": "8.3.1",
      "targets": [
        {
          "connectionArgs": {
            "catalog": "__default",
            "database": "__default",
            "region": "__default"
          },
          "datasource": {
            "type": "grafana-athena-datasource",
            "uid": "${DS_ATHENA_SHARED}"
          },
          "format": 1,
          "rawSQL": "select ( CASE line_item_usage_account_id\n  WHEN 'account_id' THEN 'account_name'\n END),\n  resource_tags_user_department as department,\n  sum(line_item_blended_cost) as cost\nfrom $CUR_Table\nwhere\n  $__timeFilter(bill_billing_period_start_date)\nand\n  resource_tags_user_department in ($Departments)\ngroup by resource_tags_user_department, line_item_usage_account_id\norder by  line_item_usage_account_id DESC\n",
          "refId": "A"
        }
      ],
      "title": "Cost of a department in each account",
      "transformations": [
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "cost"
              }
            ]
          }
        }
      ],
      "type": "barchart"
    },
    {
      "datasource": {
        "type": "grafana-athena-datasource",
        "uid": "${DS_ATHENA_SHARED}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "left",
            "axisSoftMin": 0,
            "fillOpacity": 80,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 19
      },
      "id": 7,
      "options": {
        "barWidth": 0.97,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "hidden",
          "placement": "bottom"
        },
        "orientation": "vertical",
        "showValue": "always",
        "stacking": "normal",
        "tooltip": {
          "mode": "multi"
        },
        "xTickLabelRotation": 0
      },
      "pluginVersion": "8.3.1",
      "targets": [
        {
          "connectionArgs": {
            "catalog": "__default",
            "database": "__default",
            "region": "__default"
          },
          "datasource": {
            "type": "grafana-athena-datasource",
            "uid": "${DS_ATHENA_SHARED}"
          },
          "format": 1,
          "rawSQL": "select \n  line_item_product_code as product,\n  resource_tags_user_department as department,\n  sum(line_item_blended_cost) as cost\nfrom $CUR_Table\nwhere\n  $__timeFilter(bill_billing_period_start_date)\nand\n  resource_tags_user_department in ($Departments)\nand\n  line_item_product_code in ($Services)\ngroup by line_item_product_code, resource_tags_user_department\norder by line_item_product_code DESC\n",
          "refId": "A"
        }
      ],
      "title": "Cost of a service per department",
      "transformations": [
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "cost"
              }
            ]
          }
        }
      ],
      "type": "barchart"
    },
    {
      "datasource": {
        "type": "grafana-athena-datasource",
        "uid": "${DS_ATHENA_SHARED}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "left",
            "axisSoftMin": 0,
            "fillOpacity": 80,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1
          },
          "mappings": [
            {
              "options": {
                "match": "empty",
                "result": {
                  "index": 0,
                  "text": "Total"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 29
      },
      "id": 8,
      "options": {
        "barWidth": 0.97,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "hidden",
          "placement": "bottom"
        },
        "orientation": "vertical",
        "showValue": "always",
        "stacking": "normal",
        "tooltip": {
          "mode": "multi"
        },
        "xTickLabelRotation": 0
      },
      "pluginVersion": "8.3.1",
      "targets": [
        {
          "connectionArgs": {
            "catalog": "__default",
            "database": "__default",
            "region": "__default"
          },
          "datasource": {
            "type": "grafana-athena-datasource",
            "uid": "${DS_ATHENA_SHARED}"
          },
          "format": 1,
          "rawSQL": "select \n  resource_tags_user_department as department,\n  sum(line_item_blended_cost) as cost\nfrom $CUR_Table\nwhere\n  $__timeFilter(bill_billing_period_start_date)\ngroup by resource_tags_user_department\norder by resource_tags_user_department ASC",
          "refId": "A"
        }
      ],
      "title": "Invoice spend by department",
      "transformations": [
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "cost"
              }
            ]
          }
        }
      ],
      "type": "barchart"
    },
    {
      "datasource": {
        "type": "grafana-athena-datasource",
        "uid": "${DS_ATHENA_SHARED}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "left",
            "axisSoftMin": 0,
            "fillOpacity": 80,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "currencyUSD"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 39
      },
      "id": 9,
      "options": {
        "barWidth": 0.97,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "hidden",
          "placement": "bottom"
        },
        "orientation": "vertical",
        "showValue": "always",
        "stacking": "normal",
        "tooltip": {
          "mode": "multi"
        },
        "xTickLabelRotation": 0
      },
      "pluginVersion": "8.3.1",
      "targets": [
        {
          "connectionArgs": {
            "catalog": "__default",
            "database": "__default",
            "region": "__default"
          },
          "datasource": {
            "type": "grafana-athena-datasource",
            "uid": "${DS_ATHENA_SHARED}"
          },
          "format": 1,
          "rawSQL": "select ( CASE line_item_usage_account_id\n  WHEN 'account_id' THEN 'account_name'\n  END),\n  sum(line_item_blended_cost) as cost\nfrom $CUR_Table\nwhere\n  $__timeFilter(bill_billing_period_start_date)\ngroup by line_item_usage_account_id\norder by line_item_usage_account_id DESC",
          "refId": "A"
        }
      ],
      "title": "Invoice spend by account",
      "transformations": [
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "cost"
              }
            ]
          }
        }
      ],
      "type": "barchart"
    }
  ],
  "refresh": "",
  "schemaVersion": 33,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "Athena shared",
          "value": "Athena shared"
        },
        "hide": 2,
        "includeAll": false,
        "multi": false,
        "name": "Datasource",
        "options": [],
        "query": "grafana-athena-datasource",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {},
        "datasource": {
          "type": "grafana-athena-datasource",
          "uid": "${DS_ATHENA_SHARED}"
        },
        "definition": "",
        "hide": 2,
        "includeAll": false,
        "multi": false,
        "name": "CUR_Table",
        "options": [],
        "query": {
          "rawSQL": "show tables"
        },
        "refresh": 1,
        "regex": "^(?!cost_and_usage_data_status).+$",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "grafana-athena-datasource",
          "uid": "${DS_ATHENA_SHARED}"
        },
        "definition": "",
        "hide": 2,
        "includeAll": true,
        "multi": true,
        "name": "Regions",
        "options": [],
        "query": {
          "rawSQL": "select distinct product_location from $CUR_Table where product_location != '';"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "allValue": "",
        "current": {},
        "datasource": {
          "type": "grafana-athena-datasource",
          "uid": "${DS_ATHENA_SHARED}"
        },
        "definition": "select distinct line_item_product_code from $CUR_Table;",
        "description": "Departments",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "Departments",
        "options": [],
        "query": {
          "rawSQL": "select distinct resource_tags_user_department from $CUR_Table;"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "grafana-athena-datasource",
          "uid": "${DS_ATHENA_SHARED}"
        },
        "definition": "",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "Services",
        "options": [],
        "query": {
          "rawSQL": "select distinct line_item_product_code from $CUR_Table;"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-90d",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Cloud Cost Report",
  "uid": "4HnR2qa7k",
  "version": 1,
  "weekStart": "",
  "gnetId": 15970,
  "description": "Empathy Cloud Cost Report."
}