Menu
Amazon Elastic Compute Cloud
User Guide for Linux Instances

Aggregate Statistics by Auto Scaling Group

Aggregate statistics are available for the instances that have detailed monitoring enabled. Instances that use basic monitoring are not included in the aggregates. In addition, Amazon CloudWatch does not aggregate data across Regions. Therefore, metrics are completely separate between Regions. Before you can get statistics aggregated across instances, you must enable detailed monitoring (at an additional charge), which provides data in 1-minute periods.

This scenario shows you how to use the AWS Management Console, the get-metric-statistics command, or the GetMetricStatistics API with the DiskWriteBytes metric to retrieve the total bytes written to disk for one Auto Scaling group. The total is computed for one-minute periods for a 24-hour interval across all EC2 instances in the specified AutoScalingGroupName.

Note

Start and end times must be within the last 14 days.

We assume for this example that an EC2 application is running and has an Auto Scaling group named test-group-1.

AWS Management Console

To display total DiskWriteBytes for an auto-scaled application

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. If necessary, from the navigation bar, change the region to match the region where you have your instances.

  3. In the navigation pane, click Metrics.

  4. In the CloudWatch Metrics by Category pane, under EC2 Metrics, select By Auto Scaling Group.

  5. Select the row that contains DiskWriteBytes.

    A graph showing DiskWriteBytes for all EC2 instances appears in the details pane.

    Metrics aggregated across an Auto Scaling group
  6. To change the statistic or period for the metric, choose a different value from the list.

    Metrics aggregated by AMI

AWS Command Line Interface

To get total DiskWriteBytes for an auto-scaled application

Use the get-metric-statistics command as follows.

$ aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name DiskWriteBytes --period 360 --statistics "Sum" "SampleCount" --dimensions Name=AutoScalingGroupName,Value=my-group --start-time 2014-02-16T23:18:00 --end-time 2014-02-18T23:18:00

The following is example output:

{
    "Datapoints": [
        {
            "SampleCount": 18.0, 
            "Timestamp": "2014-02-19T21:36:00Z", 
            "Sum": 0.0, 
            "Unit": "Bytes"
        }, 
        {
            "SampleCount": 5.0, 
            "Timestamp": "2014-02-19T21:42:00Z", 
            "Sum": 0.0, 
            "Unit": "Bytes"
        }
    ], 
    "Label": "DiskWriteBytes"
}