Grafana dashboard: AWS Asset Inventory
Description: This  dashboard provides a high level view of all your resources across all accounts accounts and regions

# AWS Cloud Asset Inventory

This  dashboard provides a high level view of all your resources across all accounts accounts and regions. This works with PostgreSQL as the storage layer and CloudQuery (https://github.com/cloudquery/cloudquery) as the ingestion layer.

## How to Install

 1. Install [CloudQuery](https://www.cloudquery.io/docs/quickstart/) and fetch your resources
 2. [Follow the instructions for installing the view and dashboard here](https://github.com/cloudquery/cloudquery/tree/main/plugins/source/aws/dashboards)

## GitHub

Feel free to contribute or open an [issue](https://github.com/cloudquery/cloudquery)

{
  "__inputs": [
    {
      "name": "DS_POSTGRESQL",
      "label": "PostgreSQL",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "panel",
      "id": "barchart",
      "name": "Bar chart",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.4.7"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "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": 1653764777747,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": "${DS_POSTGRESQL}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 7,
        "x": 0,
        "y": 0
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select count(*) from aws_resources where account_id in (${account_ids}) and region in (${regions}) and cq_table in (${cq_tables}) ;",
          "refId": "A"
        }
      ],
      "title": "Total Resources",
      "type": "stat"
    },
    {
      "datasource": "${DS_POSTGRESQL}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 7,
        "y": 0
      },
      "id": 8,
      "options": {
        "displayLabels": [
          "percent"
        ],
        "legend": {
          "displayMode": "list",
          "placement": "bottom"
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select account_id, count(*) from aws_resources where region in (${regions}) and cq_table in (${cq_tables}) group by account_id order by count desc;",
          "refId": "A"
        }
      ],
      "title": "Total Resource by Account",
      "type": "piechart"
    },
    {
      "datasource": "${DS_POSTGRESQL}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-BlYlRd"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "axisSoftMin": 0,
            "fillOpacity": 80,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1,
            "scaleDistribution": {
              "type": "linear"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 9,
        "x": 15,
        "y": 0
      },
      "id": 11,
      "options": {
        "barRadius": 0,
        "barWidth": 0.97,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "orientation": "auto",
        "showValue": "auto",
        "stacking": "none",
        "tooltip": {
          "mode": "single",
          "sort": "none"
        },
        "xTickLabelRotation": -90,
        "xTickLabelSpacing": 0
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select region, count(*) from aws_resources where account_id in (${account_ids}) group by region order by count desc;",
          "refId": "A"
        }
      ],
      "title": "Resources by Region",
      "type": "barchart"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "cq_meta"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 392
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "cq_table"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 326
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "account_id"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 188
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "region"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 164
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "fetch_date"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 270
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "cq_id"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 293
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 12,
        "w": 24,
        "x": 0,
        "y": 9
      },
      "id": 2,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select cq_id, cq_table, account_id, region, arn, fetch_date from aws_resources where account_id in (${account_ids}) and region in (${regions}) and cq_table in (${cq_tables}) ;",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "AWS Resources",
      "type": "table"
    },
    {
      "datasource": "${DS_POSTGRESQL}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 6,
        "x": 0,
        "y": 21
      },
      "id": 4,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select cq_table, count(*) from aws_resources where account_id in (${account_ids}) and region in (${regions}) group by cq_table order by count desc;",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "data_transfer_progress_current_rate_in_mega_bytes_per_second"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "aws_redshift_clusters",
          "timeColumn": "cluster_create_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Count by Resource Type",
      "type": "table"
    },
    {
      "datasource": "${DS_POSTGRESQL}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "region"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 207
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "count"
            },
            "properties": [
              {
                "id": "custom.width"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 12,
        "w": 7,
        "x": 6,
        "y": 21
      },
      "id": 10,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.4.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select region, count(*) from aws_resources where account_id in (${account_ids}) group by region order by count desc;",
          "refId": "A"
        }
      ],
      "title": "Resources by Region",
      "type": "table"
    }
  ],
  "schemaVersion": 35,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_POSTGRESQL}"
        },
        "definition": "select distinct(account_id) from aws_resources",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "account_ids",
        "options": [],
        "query": "select distinct(account_id) from aws_resources",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_POSTGRESQL}"
        },
        "definition": "select distinct(region) from aws_resources;",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "regions",
        "options": [],
        "query": "select distinct(region) from aws_resources;",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "definition": "select distinct(cq_table) from aws_resources;",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "cq_tables",
        "options": [],
        "query": "select distinct(cq_table) from aws_resources;",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query",
        "datasource": "${DS_POSTGRESQL}"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "AWS Asset Inventory",
  "uid": "aws_asset_inventoryqwe",
  "version": 2,
  "weekStart": "",
  "gnetId": 16347,
  "description": "This  dashboard provides a high level view of all your resources across all accounts accounts and regions"
}