Accessing CloudWatch metrics - Amazon Simple Storage Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Accessing CloudWatch metrics

You can use the following procedures to view the storage metrics for Amazon S3. To get the Amazon S3 metrics involved, you must set a start and end timestamp. For metrics for any given 24-hour period, set the time period to 86400 seconds, the number of seconds in a day. Also, remember to set the BucketName and StorageType dimensions.

For example, if you want to use the Amazon CLI to get the average of a specific bucket's size in bytes, you could use the following command:

aws cloudwatch get-metric-statistics --metric-name BucketSizeBytes --namespace AWS/S3 --start-time 2016-10-19T00:00:00Z --end-time 2016-10-20T00:00:00Z --statistics Average --unit Bytes --region us-west-2 --dimensions Name=BucketName,Value=DOC-EXAMPLE-BUCKET Name=StorageType,Value=StandardStorage --period 86400 --output json

This example produces the following output.

{ "Datapoints": [ { "Timestamp": "2016-10-19T00:00:00Z", "Average": 1025328.0, "Unit": "Bytes" } ], "Label": "BucketSizeBytes" }
To view metrics by using the Amazon CloudWatch console
  1. Open the CloudWatch console at https://console.amazonaws.cn/cloudwatch/.

  2. In the left navigation pane, choose Metrics.

  3. Choose the S3 namespace.

  4. (Optional) To view a metric, enter the metric name in the search box.

  5. (Optional) To filter by the StorageType dimension, enter the name of the storage class in the search box.

To view a list of valid metrics stored for your Amazon Web Services account by using the Amazon CLI
  • At a command prompt, use the following command.

    aws cloudwatch list-metrics --namespace "AWS/S3"

For more information about the permissions required to access CloudWatch dashboards, see Amazon CloudWatch dashboard permissions in the Amazon CloudWatch User Guide.