Table: aws_cloudwatch_metric - Query AWS CloudWatch Metrics using SQL
The AWS CloudWatch Metrics is a feature of Amazon CloudWatch that allows you to monitor, store, and access your log files from Amazon Elastic Compute Cloud (EC2) instances, AWS CloudTrail, Route 53, and other sources. It provides data and actionable insights to monitor your applications, understand and respond to system-wide performance changes, optimize resource utilization, and get a unified view of operational health. By using SQL queries with CloudWatch Metrics, you can gain a deeper understanding of your system's operational status.
Table Usage Guide
The aws_cloudwatch_metric
table in Steampipe provides you with information about CloudWatch Metrics within AWS CloudWatch. This table allows you, as a DevOps engineer, to query metric-specific details, including metric names, namespaces, dimensions, and statistics. You can utilize this table to gather insights on metrics, such as tracking the CPU usage of an EC2 instance, monitoring the latency of an ELB, or even the request count of an API Gateway. The schema outlines the various attributes of the CloudWatch Metric for you, including the metric name, namespace, dimensions, statistics, and associated metadata.
Important Notes
- You can include up to 10 dimensions in the
dimensions_filter
column.
Examples
Basic info
Explore the metrics and their associated namespaces in your AWS CloudWatch service. This can help you understand the different performance indicators being monitored and their corresponding AWS services, providing a comprehensive overview of your system's performance and health.
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metric;
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metric;
List EBS metrics
Explore the performance metrics related to Amazon Elastic Block Store (EBS) to gain insights into its operations and efficiency. This can help in identifying potential issues and optimizing resource usage.
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metricwhere namespace = 'AWS/EBS';
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metricwhere namespace = 'AWS/EBS';
List EBS VolumeReadOps
metrics
Discover the segments that track the read operations on your Elastic Block Store (EBS) volumes. This is useful for monitoring the performance and usage patterns of your EBS volumes in AWS environment.
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metricwhere namespace = 'AWS/EBS' and metric_name = 'VolumeReadOps';
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metricwhere namespace = 'AWS/EBS' and metric_name = 'VolumeReadOps';
List metrics for a specific Redshift cluster
Explore the performance metrics of a specific Redshift cluster to gain insights into its operational efficiency and resource utilization. This can be useful in monitoring the cluster's health and optimizing its performance.
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metricwhere dimensions_filter = '[ {"Name": "ClusterIdentifier", "Value": "my-cluster-1"} ]' :: jsonb;
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metricwhere json_extract(dimensions_filter, '$[0].Name') = 'ClusterIdentifier' and json_extract(dimensions_filter, '$[0].Value') = 'my-cluster-1';
List EC2 API metrics
Explore which API metrics are available for the EC2 service in AWS Cloudwatch. This is useful for monitoring and optimizing the performance of your EC2 instances.
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metricwhere dimensions_filter = '[ {"Name": "Type", "Value": "API"}, {"Name": "Service", "Value": "EC2"} ]' :: jsonb;
select metric_name, namespace, dimensionsfrom aws_cloudwatch_metricwhere json_extract(dimensions_filter, '$[0].Name') = "Type" and json_extract(dimensions_filter, '$[0].Value') = "API" and json_extract(dimensions_filter, '$[1].Name') = "Service" and json_extract(dimensions_filter, '$[1].Value') = "EC2";
Schema for aws_cloudwatch_metric
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
dimensions | jsonb | The dimensions for the metric. | |
dimensions_filter | jsonb | = | The dimensions to filter against. |
metric_name | text | = | The name of the metric. |
namespace | text | = | The namespace for the metric. |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
region | text | The AWS Region in which the resource is located. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_cloudwatch_metric