Creating a CloudWatch metrics configuration for all the objects in your bucket - Amazon Simple Storage Service

Creating a CloudWatch metrics configuration for all the objects in your bucket

When you configure request metrics, you can create a CloudWatch metrics configuration for all the objects in your bucket, or you can filter by prefix or object tag.

The procedures in this topic show you how to create a configuration for all the objects in your bucket. To create a configuration that filters by object tag or prefix, see Creating a metrics configuration that filters by object key name prefix or tag.

There are three types of Amazon CloudWatch metrics for Amazon S3: storage metrics, request metrics, and replication metrics. Storage metrics are reported once per day and are provided to all customers at no additional cost. Request metrics are available at one-minute intervals after some latency to process. Request metrics are billed at the standard CloudWatch rate. You must opt into request metrics by configuring them in the console or using the Amazon S3 API.

For more information about CloudWatch metrics for Amazon S3, see Monitoring metrics with Amazon CloudWatch.

You can add metrics configurations to a bucket using the Amazon S3 console, the AWS Command Line Interface (AWS CLI), or the Amazon S3 REST API.

  1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.

  2. In the Buckets list, choose the name of the bucket that contains the objects you want request metrics for.

  3. Choose the Metrics tab.

  4. Under Bucket metrics, choose View additional charts.

  5. Choose the Request metrics tab.

  6. Choose Create filter.

  7. In the Filter name box, enter your filter name.

    Names can only contain letters, numbers, periods, dashes, and underscores. We recommend using the name EntireBucket for a filter that applies to all objects.

  8. Under Choose a filter scope, choose This filter applies to all objects in the bucket.

    You can also define a filter so that the metrics are only collected and reported on a subset of objects in the bucket. For more information, see Creating a metrics configuration that filters by object key name prefix or tag.

  9. Choose Create filter.

  10. On the Request metrics tab, under Filters, choose the filter that you just created.

    After about 15 minutes, CloudWatch begins tracking these request metrics. You can see them on the Request metrics tab. You can see graphs for the metrics on the Amazon S3 or CloudWatch console. Request metrics are billed at the standard CloudWatch rate. For more information, see Amazon CloudWatch pricing.

You can also add metrics configurations programmatically with the Amazon S3 REST API. For more information about adding and working with metrics configurations, see the following topics in the Amazon Simple Storage Service API Reference:

  1. Install and set up the AWS CLI. For instructions, see Installing, updating, and uninstalling the AWS CLI in the AWS Command Line Interface User Guide.

  2. Open a terminal.

  3. Run the following command to add a metrics configuration.

    aws s3api put-bucket-metrics-configuration --endpoint https://s3.us-west-2.amazonaws.com --bucket bucket-name --id metrics-config-id --metrics-configuration '{"Id":"metrics-config-id"}'