

# Monitoring metrics with Amazon CloudWatch
Monitoring metrics with CloudWatch

Amazon CloudWatch metrics for Amazon S3 can help you understand and improve the performance of applications that use Amazon S3. There are several ways that you can use CloudWatch with Amazon S3.

**Daily storage metrics for buckets**  
Monitor bucket storage using CloudWatch, which collects and processes storage data from Amazon S3 into readable, daily metrics. These storage metrics for Amazon S3 are reported once per day and are provided to all customers at no additional cost.

**Request metrics**   
Monitor Amazon S3 requests to quickly identify and act on operational issues. The metrics are available at 1-minute intervals after some latency for processing. These CloudWatch metrics are billed at the same rate as the Amazon CloudWatch custom metrics. For information about CloudWatch pricing, see [Amazon CloudWatch pricing](http://www.amazonaws.cn/cloudwatch/pricing/). To learn how to opt in to getting these metrics, see [CloudWatch metrics configurations](metrics-configurations.md).  
When enabled, request metrics are reported for all object operations. By default, these 1-minute metrics are available at the Amazon S3 bucket level. You can also define a filter for the metrics using a shared prefix, object tag, or access point:  
+ **Access point** – Access points are named network endpoints that are attached to buckets and simplify managing data access at scale for shared datasets in S3. With the access point filter, you can gain insights into your access point usage. For more information about access points, see [Monitoring and logging access points](access-points-monitoring-logging.md).
+ **Prefix** – Although the Amazon S3 data model is a flat structure, you can use prefixes to infer a hierarchy. A prefix is similar to a directory name that enables you to group similar objects together in a bucket. The S3 console supports prefixes with the concept of folders. If you filter by prefix, objects that have the same prefix are included in the metrics configuration. For more information about prefixes, see [Organizing objects using prefixes](using-prefixes.md). 
+ **Tags** – Tags are key-value name pairs that you can add to objects. Tags help you find and organize objects easily. You can also use tags as a filter for metrics configurations so that only objects with those tags are included in the metrics configuration. For more information about object tags, see [Categorizing your objects using tags](object-tagging.md). 
To align these metrics to specific business applications, workflows, or internal organizations, you can filter on a shared prefix, object tag, or access point. 

**Replication metrics**  
Monitor the total number of S3 API operations that are pending replication, the total size of objects pending replication, the maximum replication time to the destination Amazon Web Services Region, and the total number of operations that failed replication. Replication rules that have S3 Replication Time Control (S3 RTC) or S3 Replication metrics enabled will publish replication metrics.   
For more information, see [Monitoring replication with metrics, event notifications, and statuses](replication-metrics.md) or [Meeting compliance requirements with S3 Replication Time Control](replication-time-control.md).

**Amazon S3 Storage Lens metrics**  
You can publish S3 Storage Lens usage and activity metrics to Amazon CloudWatch to create a unified view of your operational health in CloudWatch [dashboards](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html). S3 Storage Lens metrics are available in the `AWS/S3/Storage-Lens` namespace. The CloudWatch publishing option is available for S3 Storage Lens dashboards upgraded to *advanced metrics and recommendations*. You can enable the CloudWatch publishing option for a new or existing dashboard configuration in S3 Storage Lens.  
For more information, see [Monitor S3 Storage Lens metrics in CloudWatch](storage_lens_view_metrics_cloudwatch.md).

All CloudWatch statistics are retained for a period of 15 months so that you can access historical information and gain a better perspective on how your web application or service is performing. For more information about CloudWatch, see [What is Amazon CloudWatch?](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html) in the *Amazon CloudWatch User Guide*. You may need some additional configurations to your CloudWatch alarms, depending on your use cases. For example, you can use metric math expression to create an alarm. For more information, see [Use CloudWatch metrics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/working_with_metrics.html), [Use metric math](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/using-metric-math.html), [Using Amazon CloudWatch alarms](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html), and [Create a CloudWatch alarm based on a metric math expression](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html) in the *Amazon CloudWatch User Guide*.

**Best-effort CloudWatch metrics delivery**  
 CloudWatch metrics are delivered on a best-effort basis. Most requests for an Amazon S3 object that have request metrics result in a data point being sent to CloudWatch.

The completeness and timeliness of metrics are not guaranteed. The data point for a particular request might be returned with a timestamp that is later than when the request was actually processed. The data point for a minute might be delayed before being available through CloudWatch, or it might not be delivered at all. CloudWatch request metrics give you an idea of the nature of traffic against your bucket in near-real time. It is not meant to be a complete accounting of all requests.

It follows from the best-effort nature of this feature that the reports available at the [Billing & Cost Management Dashboard](https://console.amazonaws.cn/billing/home?#/) might include one or more access requests that do not appear in the bucket metrics.

For more information, see the following topics.

**Topics**
+ [

# Metrics and dimensions
](metrics-dimensions.md)
+ [

# Accessing CloudWatch metrics
](cloudwatch-monitoring-accessing.md)
+ [

# CloudWatch metrics configurations
](metrics-configurations.md)

# Metrics and dimensions


The storage metrics and dimensions that Amazon S3 sends to Amazon CloudWatch are listed in the following tables.

**Best-effort CloudWatch metrics delivery**  
 CloudWatch metrics are delivered on a best-effort basis. Most requests for an Amazon S3 object that have request metrics result in a data point being sent to CloudWatch.

The completeness and timeliness of metrics are not guaranteed. The data point for a particular request might be returned with a timestamp that is later than when the request was actually processed. The data point for a minute might be delayed before being available through CloudWatch, or it might not be delivered at all. CloudWatch request metrics give you an idea of the nature of traffic against your bucket in near-real time. It is not meant to be a complete accounting of all requests.

It follows from the best-effort nature of this feature that the reports available at the [Billing & Cost Management Dashboard](https://console.amazonaws.cn/billing/home?#/) might include one or more access requests that do not appear in the bucket metrics.

**Topics**
+ [

## Amazon S3 daily storage metrics for buckets in CloudWatch
](#s3-cloudwatch-metrics)
+ [

## Amazon S3 request metrics in CloudWatch
](#s3-request-cloudwatch-metrics)
+ [

## S3 Replication metrics in CloudWatch
](#s3-cloudwatch-replication-metrics)
+ [

## S3 Storage Lens metrics in CloudWatch
](#storage-lens-metrics-cloudwatch-publish)
+ [

## S3 Object Lambda request metrics in CloudWatch
](#olap-cloudwatch-metrics)
+ [

## Amazon S3 dimensions in CloudWatch
](#s3-cloudwatch-dimensions)
+ [

## S3 Replication dimensions in CloudWatch
](#s3-replication-dimensions)
+ [

## S3 Storage Lens dimensions in CloudWatch
](#storage-lens-dimensions)
+ [

## S3 Object Lambda request dimensions in CloudWatch
](#olap-dimensions)
+ [

## Amazon S3 usage metrics
](#s3-service-quota-metrics)

## Amazon S3 daily storage metrics for buckets in CloudWatch


The `AWS/S3` namespace includes the following daily storage metrics for buckets.


| Metric | Description | 
| --- | --- | 
| BucketSizeBytes |  The amount of data in bytes that is stored in a bucket in the following storage classes:  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/en_us/AmazonS3/latest/userguide/metrics-dimensions.html) This value is calculated by summing the size of all objects and metadata (such as bucket names) in the bucket (both current and noncurrent objects), including the size of all parts for all incomplete multipart uploads to the bucket.   The S3 Express One Zone storage class is available only for directory buckets.  Valid storage-type filters (see the `StorageType` dimension):  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/en_us/AmazonS3/latest/userguide/metrics-dimensions.html) Units: Bytes Valid statistics: Average For more information about the `StorageType` dimensions, see [Amazon S3 dimensions in CloudWatch](#s3-cloudwatch-dimensions).  | 
| NumberOfObjects |  The total number of objects stored in a general purpose bucket for all storage classes. This value is calculated by counting all objects in the bucket, which includes current and noncurrent objects, delete markers, and the total number of parts for all incomplete multipart uploads to the bucket. For directory buckets with objects in the S3 Express One Zone storage class, this value is calculated by counting all objects in the bucket, but it doesn't include incomplete multipart uploads to the bucket. Valid storage type filters: `AllStorageTypes` (see the `StorageType` dimension) Units: Count Valid statistics: Average  | 

## Amazon S3 request metrics in CloudWatch


The `AWS/S3` namespace includes the following request metrics. These metrics include non-billable requests (in the case of `GET` requests from `CopyObject` and Replication).


| Metric | Description | 
| --- | --- | 
| AllRequests |  The total number of HTTP requests made to an Amazon S3 bucket, regardless of type. If you're using a metrics configuration with a filter, then this metric returns only the HTTP requests that meet the filter's requirements. Units: Count Valid statistics: Sum  | 
| GetRequests |  The number of HTTP `GET` requests made for objects in an Amazon S3 bucket. This doesn't include list operations. This metric is incremented for the source of each `CopyObject` request. Units: Count Valid statistics: Sum  Paginated list-oriented requests, such as [https://docs.amazonaws.cn/AmazonS3/latest/API/mpUploadListMPUpload.html](https://docs.amazonaws.cn/AmazonS3/latest/API/mpUploadListMPUpload.html), [https://docs.amazonaws.cn/AmazonS3/latest/API/mpUploadListParts.html](https://docs.amazonaws.cn/AmazonS3/latest/API/mpUploadListParts.html), [https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketGETVersion.html](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketGETVersion.html), and others, are not included in this metric.   | 
| PutRequests |  The number of HTTP `PUT` requests made for objects in an Amazon S3 bucket. This metric is incremented for the destination of each `CopyObject` request. Units: Count Valid statistics: Sum  | 
| DeleteRequests |  The number of HTTP `DELETE` requests made for objects in an Amazon S3 bucket. This metric also includes [https://docs.amazonaws.cn/AmazonS3/latest/API/multiobjectdeleteapi.html](https://docs.amazonaws.cn/AmazonS3/latest/API/multiobjectdeleteapi.html) requests. This metric shows the number of requests made, not the number of objects deleted. Units: Count Valid statistics: Sum  | 
| HeadRequests |  The number of HTTP `HEAD` requests made to an Amazon S3 bucket. Units: Count Valid statistics: Sum  | 
| PostRequests |  The number of HTTP `POST` requests made to an Amazon S3 bucket. Units: Count Valid statistics: Sum  [https://docs.amazonaws.cn/AmazonS3/latest/API/multiobjectdeleteapi.html](https://docs.amazonaws.cn/AmazonS3/latest/API/multiobjectdeleteapi.html) and [https://docs.amazonaws.cn/AmazonS3/latest/API/RESTObjectSELECTContent.html](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTObjectSELECTContent.html) requests are not included in this metric.    | 
| SelectRequests |  The number of Amazon S3 [https://docs.amazonaws.cn/AmazonS3/latest/API/RESTObjectSELECTContent.html](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTObjectSELECTContent.html) requests made for objects in an Amazon S3 bucket.  Units: Count Valid statistics: Sum  | 
| SelectBytesScanned |  The number of bytes of data scanned with Amazon S3 [https://docs.amazonaws.cn/AmazonS3/latest/API/RESTObjectSELECTContent.html](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTObjectSELECTContent.html) requests in an Amazon S3 bucket.   Units: Bytes  Valid statistics: Average (bytes per request), Sum (bytes per period), Sample Count, Min, Max (same as p100), any percentile between p0.0 and p99.9  | 
| SelectBytesReturned |  The number of bytes of data returned with Amazon S3 [https://docs.amazonaws.cn/AmazonS3/latest/API/RESTObjectSELECTContent.html](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTObjectSELECTContent.html) requests in an Amazon S3 bucket.   Units: Bytes  Valid statistics: Average (bytes per request), Sum (bytes per period), Sample Count, Min, Max (same as p100), any percentile between p0.0 and p99.9  | 
| ListRequests |  The number of HTTP requests that list the contents of a bucket. Units: Count Valid statistics: Sum  | 
| BytesDownloaded |  The number of bytes downloaded for requests made to an Amazon S3 bucket, where the response includes a body. Units: Bytes Valid statistics: Average (bytes per request), Sum (bytes per period), Sample Count, Min, Max (same as p100), any percentile between p0.0 and p99.9  | 
| BytesUploaded |  The number of bytes uploaded for requests made to an Amazon S3 bucket, where the request includes a body. Units: Bytes Valid statistics: Average (bytes per request), Sum (bytes per period), Sample Count, Min, Max (same as p100), any percentile between p0.0 and p99.9  | 
| 4xxErrors |  The number of HTTP 4*xx* client error status code requests made to an Amazon S3 bucket with a value of either 0 or 1. The Average statistic shows the error rate, and the Sum statistic shows the count of that type of error, during each period. Units: Count Valid statistics: Average (reports per request), Sum (reports per period), Min, Max, Sample Count  | 
| 5xxErrors |  The number of HTTP 5*xx* server error status code requests made to an Amazon S3 bucket with a value of either 0 or 1. The Average statistic shows the error rate, and the Sum statistic shows the count of that type of error, during each period. Units: Count Valid statistics: Average (reports per request), Sum (reports per period), Min, Max, Sample Count  | 
| FirstByteLatency |  The per-request time from the complete request being received by an Amazon S3 bucket to when the response starts to be returned. Units: Milliseconds Valid statistics: Average, Sum, Min, Max (same as p100), Sample Count, any percentile between p0.0 and p100  | 
| TotalRequestLatency |  The elapsed per-request time from the first byte received to the last byte sent to an Amazon S3 bucket. This metric includes the time taken to receive the request body and send the response body, which is not included in `FirstByteLatency`. Units: Milliseconds Valid statistics: Average, Sum, Min, Max (same as p100), Sample Count, any percentile between p0.0 and p100  | 

## S3 Replication metrics in CloudWatch


You can monitor the progress of replication with S3 Replication metrics by tracking bytes pending, operations pending, and replication latency. For more information, see [Monitoring progress with replication metrics](https://docs.amazonaws.cn/AmazonS3/latest/userguide/replication-metrics.html).

**Note**  
You can enable alarms for your replication metrics in Amazon CloudWatch. When you set up alarms for your replication metrics, set the **Missing data treatment** field to **Treat missing data as ignore (maintain the alarm state)**.


| Metric | Description | 
| --- | --- | 
| ReplicationLatency |  The maximum number of seconds by which the replication destination Amazon Web Services Region is behind the source Amazon Web Services Region for a given replication rule.  Units: Seconds Valid statistics: Max  | 
| BytesPendingReplication |  The total number of bytes of objects pending replication for a given replication rule. Units: Bytes Valid statistics: Max  | 
| OperationsPendingReplication |  The number of operations pending replication for a given replication rule. Units: Count Valid statistics: Max  | 
| OperationsFailedReplication |  The number of operations that failed to replicate for a given replication rule. Units: Count  Valid statistics: Sum (total number of failed operations), Average (failure rate), Sample Count (total number of replication operations)  | 

## S3 Storage Lens metrics in CloudWatch


You can publish S3 Storage Lens usage and activity metrics to Amazon CloudWatch to create a unified view of your operational health in [CloudWatch dashboards](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html). S3 Storage Lens metrics are published to the `AWS/S3/Storage-Lens` namespace in CloudWatch. The CloudWatch publishing option is available for S3 Storage Lens dashboards that have been upgraded to advanced metrics and recommendations.

For a list of S3 Storage Lens metrics that are published to CloudWatch, see [Amazon S3 Storage Lens metrics glossary](storage_lens_metrics_glossary.md). For a complete list of dimensions, see [Dimensions](storage-lens-cloudwatch-metrics-dimensions.md#storage-lens-cloudwatch-dimensions).

## S3 Object Lambda request metrics in CloudWatch


S3 Object Lambda includes the following request metrics.


| Metric | Description | 
| --- | --- | 
| AllRequests |  The total number of HTTP requests made to an Amazon S3 bucket by using an Object Lambda Access Point. Units: Count Valid statistics: Sum  | 
| GetRequests |  The number of HTTP `GET` requests made for objects by using an Object Lambda Access Point. This metric does not include list operations. Units: Count Valid statistics: Sum  | 
| BytesUploaded |  The number of bytes uploaded to an Amazon S3 bucket by using an Object Lambda Access Point, where the request includes a body. Units: Bytes Valid statistics: Average (bytes per request), Sum (bytes per period), Sample Count, Min, Max (same as p100), any percentile between p0.0 and p99.9  | 
| PostRequests |  The number of HTTP `POST` requests made to an Amazon S3 bucket by using an Object Lambda Access Point. Units: Count Valid statistics: Sum  | 
| PutRequests |  The number of HTTP `PUT` requests made for objects in an Amazon S3 bucket by using an Object Lambda Access Point.  Units: Count  Valid statistics: Sum  | 
| DeleteRequests |  The number of HTTP `DELETE` requests made for objects in an Amazon S3 bucket by using an Object Lambda Access Point. This metric includes [https://docs.amazonaws.cn/AmazonS3/latest/API/multiobjectdeleteapi.html](https://docs.amazonaws.cn/AmazonS3/latest/API/multiobjectdeleteapi.html) requests. This metric shows the number of requests made, not the number of objects deleted. Units: Count Valid statistics: Sum  | 
| BytesDownloaded |  The number of bytes downloaded for requests made to an Amazon S3 bucket by using an Object Lambda Access Point, where the response includes a body. Units: Bytes  Valid statistics: Average (bytes per request), Sum (bytes per period), Sample Count, Min, Max (same as p100), any percentile between p0.0 and p99.9  | 
| FirstByteLatency |  The per-request time from the complete request being received by an Amazon S3 bucket through an Object Lambda Access Point to when the response starts to be returned. This metric is dependent on the Amazon Lambda function's running time to transform the object before the function returns the bytes to the Object Lambda Access Point. Units: Milliseconds  Valid statistics: Average, Sum, Min, Max (same as p100), Sample Count, any percentile between p0.0 and p100  | 
| TotalRequestLatency |  The elapsed per-request time from the first byte received to the last byte sent to an Object Lambda Access Point. This metric includes the time taken to receive the request body and send the response body, which is not included in `FirstByteLatency`. Units: Milliseconds Valid statistics: Average, Sum, Min, Max (same as p100), Sample Count, any percentile between p0.0 and p100  | 
| HeadRequests |  The number of HTTP `HEAD` requests made to an Amazon S3 bucket by using an Object Lambda Access Point. Units: Count Valid statistics: Sum  | 
| ListRequests |  The number of HTTP `GET` requests that list the contents of an Amazon S3 bucket. This metric includes both `ListObjects` and `ListObjectsV2` operations. Units: Count Valid statistics: Sum  | 
| 4xxErrors |  The number of HTTP 4*xx* client error status code requests made to an Amazon S3 bucket by using an Object Lambda Access Point with a value of either 0 or 1. The Average statistic shows the error rate, and the Sum statistic shows the count of that type of error, during each period. Units: Count  Valid statistics: Average (reports per request), Sum (reports per period), Min, Max, Sample Count  | 
| 5xxErrors |  The number of HTTP 5*xx* server error status code requests made to an Amazon S3 bucket by using an Object Lambda Access Point with a value of either 0 or 1. The Average statistic shows the error rate, and the Sum statistic shows the count of that type of error, during each period. Units: Count  Valid statistics: Average (reports per request), Sum (reports per period), Min, Max, Sample Count  | 
| ProxiedRequests |  The number of HTTP requests to an Object Lambda Access Point that return the standard Amazon S3 API response. (Such requests do not have a Lambda function configured.) Units: Count Valid statistics: Sum  | 
| InvokedLambda |  The number of HTTP requests to an S3 object where a Lambda function was invoked. Units: Count Valid statistics: Sum  | 
| LambdaResponseRequests |  The number of `WriteGetObjectResponse` requests made by the Lambda function. This metric applies only to `GetObject` requests.  | 
| LambdaResponse4xx |  The number of HTTP 4*xx* client errors that occur when calling `WriteGetObjectResponse` from a Lambda function. This metric provides the same information as `4xxErrors`, but only for `WriteGetObjectResponse` calls.  | 
| LambdaResponse5xx |  The number of HTTP 5*xx* server errors that occur when calling `WriteGetObjectResponse` from a Lambda function. This metric provides the same information as `5xxErrors`, but only for `WriteGetObjectResponse` calls.  | 

## Amazon S3 dimensions in CloudWatch


The following dimensions are used to filter Amazon S3 metrics.


|  Dimension  |  Description  | 
| --- | --- | 
|  BucketName  |  This dimension filters the data that you request for the identified bucket only.  | 
|  StorageType  |  This dimension filters the data that you have stored in a bucket by the following types of storage:  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/en_us/AmazonS3/latest/userguide/metrics-dimensions.html)  | 
| FilterId | This dimension filters metrics configurations that you specify for the request metrics on a bucket. When you create a metrics configuration, you specify a filter ID (for example, a prefix, a tag, or an access point). For more information, see [Creating a metrics configuration](https://docs.amazonaws.cn/AmazonS3/latest/userguide/metrics-configurations.html). | 

## S3 Replication dimensions in CloudWatch


The following dimensions are used to filter S3 Replication metrics.


|  Dimension  |  Description  | 
| --- | --- | 
|  SourceBucket  |  The name of the bucket objects are replicated from.  | 
|  DestinationBucket  |  The name of the bucket objects are replicated to.  | 
|  RuleId  |  A unique identifier for the rule that triggered this replication metric to update.  | 

## S3 Storage Lens dimensions in CloudWatch


For a list of dimensions that are used to filter S3 Storage Lens metrics in CloudWatch, see [Dimensions](storage-lens-cloudwatch-metrics-dimensions.md#storage-lens-cloudwatch-dimensions).

## S3 Object Lambda request dimensions in CloudWatch


The following dimensions are used to filter data from an Object Lambda Access Point.


| Dimension | Description | 
| --- | --- | 
| AccessPointName |  The name of the access point of which requests are being made.  | 
| DataSourceARN |  The source the Object Lambda Access Point is retrieving the data from. If the request invokes a Lambda function this refers to the Lambda Amazon Resource Name (ARN). Otherwise this refers to the access point ARN.  | 

## Amazon S3 usage metrics


You can use CloudWatch usage metrics to provide visibility into your account's usage of resources. Use these metrics to visualize your current service usage on CloudWatch graphs and dashboards.

Amazon S3 usage metrics correspond to Amazon service quotas. You can configure alarms that alert you when your usage approaches a service quota. For more information about CloudWatch integration with service quotas, see [Amazon usage metrics](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch-Service-Quota-Integration.html) in the *Amazon CloudWatch User Guide*.

Amazon S3 publishes the following metrics in the `AWS/Usage` namespace.


| Metric | Description | 
| --- | --- | 
| `ResourceCount` |  The number of the specified resources running in your account. The resources are defined by the dimensions associated with the metric.  | 

The following dimensions are used to refine the usage metrics that are published by Amazon S3.


| Dimension | Description | 
| --- | --- | 
|  Service  |  The name of the Amazon service containing the resource. For Amazon S3 usage metrics, the value for this dimension is `S3`.  | 
|  Type  |  The type of entity that is being reported. Currently, the only valid value for Amazon S3 usage metrics is `Resource`.  | 
|  Resource  |  The type of resource that is running. Currently, the only valid value for Amazon S3 usage metrics is `GeneralPurposeBuckets`, which returns the number of general purpose buckets in an Amazon Web Services account. General purpose buckets allow objects that are stored across all storage classes, except S3 Express One Zone.  | 

# 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.

## Using the Amazon CLI


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=amzn-s3-demo-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"
}
```

## Using the S3 console


**To view metrics by using the Amazon CloudWatch console**

1. Open the CloudWatch console at [https://console.amazonaws.cn/cloudwatch/](https://console.amazonaws.cn/cloudwatch/).

1. In the left navigation pane, choose **Metrics**. 

1. Choose the **S3** namespace.

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

1. (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.

  ```
  1. aws cloudwatch list-metrics --namespace "AWS/S3"
  ```

For more information about the permissions required to access CloudWatch dashboards, see [Amazon CloudWatch dashboard permissions](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/dashboard-permissions-update.html) in the *Amazon CloudWatch User Guide*.

# CloudWatch metrics configurations


With Amazon CloudWatch request metrics for Amazon S3, you can receive 1-minute CloudWatch metrics, set CloudWatch alarms, and access CloudWatch dashboards to view near-real-time operations and performance of your Amazon S3 storage. For applications that depend on cloud storage, these metrics let you quickly identify and act on operational issues. When enabled, these 1-minute metrics are available at the Amazon S3 bucket-level, by default.

If you want to get the CloudWatch request metrics for the objects in a bucket, you must create a metrics configuration for the bucket. For more information, see [Creating a CloudWatch metrics configuration for all the objects in your bucket](configure-request-metrics-bucket.md). 

You can also use a shared prefix, object tags, or an access point to define a filter for the metrics collected. This method of defining a filter allows you to align metrics filters to specific business applications, workflows, or internal organizations. For more information, see [Creating a metrics configuration that filters by prefix, object tag, or access point](metrics-configurations-filter.md). For more information about the CloudWatch metrics that are available and the differences between storage and request metrics, see [Monitoring metrics with Amazon CloudWatch](cloudwatch-monitoring.md).

Keep the following in mind when using metrics configurations:
+ You can have a maximum of 1,000 metrics configurations per bucket.
+ You can choose which objects in a bucket to include in metrics configurations by using filters. You can filter on a shared prefix, object tag, or access point to align metrics filters to specific business applications, workflows, or internal organizations. To request metrics for the entire bucket, create a metrics configuration without a filter.
+ Metrics configurations are necessary only to enable request metrics. Bucket-level daily storage metrics are always turned on, and are provided at no additional cost. Currently, it's not possible to get daily storage metrics for a filtered subset of objects.
+ Each metrics configuration enables the full set of [available request metrics](metrics-dimensions.md#s3-request-cloudwatch-metrics). Operation-specific metrics (such as `PostRequests`) are reported only if there are requests of that type for your bucket or your filter.
+ Request metrics are reported for object-level operations. They are also reported for operations that list bucket contents, like [GET Bucket (List Objects)](https://docs.amazonaws.cn/AmazonS3/latest/API/v2-RESTBucketGET.html), [GET Bucket Object Versions](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketGETVersion.html), and [List Multipart Uploads](https://docs.amazonaws.cn/AmazonS3/latest/API/mpUploadListMPUpload.html), but they are not reported for other operations on buckets.
+ Request metrics support filtering by prefix, object tags, or access point, but storage metrics do not.

**Best-effort CloudWatch metrics delivery**  
 CloudWatch metrics are delivered on a best-effort basis. Most requests for an Amazon S3 object that have request metrics result in a data point being sent to CloudWatch.

The completeness and timeliness of metrics are not guaranteed. The data point for a particular request might be returned with a timestamp that is later than when the request was actually processed. The data point for a minute might be delayed before being available through CloudWatch, or it might not be delivered at all. CloudWatch request metrics give you an idea of the nature of traffic against your bucket in near-real time. It is not meant to be a complete accounting of all requests.

It follows from the best-effort nature of this feature that the reports available at the [Billing & Cost Management Dashboard](https://console.amazonaws.cn/billing/home?#/) might include one or more access requests that do not appear in the bucket metrics.

For more information about working with CloudWatch metrics in Amazon S3, see the following topics.

**Topics**
+ [

# Creating a CloudWatch metrics configuration for all the objects in your bucket
](configure-request-metrics-bucket.md)
+ [

# Creating a metrics configuration that filters by prefix, object tag, or access point
](metrics-configurations-filter.md)
+ [

# Deleting a metrics filter
](delete-request-metrics-filter.md)

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

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, object tag, or access point. 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, prefix, or access point, see [Creating a metrics configuration that filters by prefix, object tag, or access point](metrics-configurations-filter.md).

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 for processing. Request metrics are billed at the standard CloudWatch rate. You must opt in to request metrics by configuring them in the console or using the Amazon S3 API. [S3 Replication metrics](https://docs.amazonaws.cn/AmazonS3/latest/userguide/viewing-replication-metrics.html) provide detailed metrics for the replication rules in your replication configuration. With replication metrics, you can monitor minute-by-minute progress by tracking bytes pending, operations pending, operations that failed replication, and replication latency.

For more information about CloudWatch metrics for Amazon S3, see [Monitoring metrics with Amazon CloudWatch](cloudwatch-monitoring.md). 

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

## Using the S3 console


1. Sign in to the Amazon Web Services Management Console and open the Amazon S3 console at [https://console.amazonaws.cn/s3/](https://console.amazonaws.cn/s3/).

1. In the left navigation pane, choose **General purpose buckets**.

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

1. Choose the **Metrics** tab.

1. Under **Bucket metrics**, choose **View additional charts**.

1. Choose the **Request metrics** tab.

1. Choose **Create filter**.

1. 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.

1. Under **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 prefix, object tag, or access point](metrics-configurations-filter.md).

1. Choose **Save changes**.

1. 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](https://www.amazonaws.cn/cloudwatch/pricing/). 

## Using the REST API


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*:
+ [PUT Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketPUTMetricConfiguration.html)
+ [GET Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketGETMetricConfiguration.html)
+ [List Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTListBucketMetricsConfiguration.html)
+ [DELETE Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTDeleteBucketMetricsConfiguration.html)

## Using the Amazon CLI


1. Install and set up the Amazon CLI. For instructions, see [Installing, updating, and uninstalling the Amazon CLI](https://docs.amazonaws.cn/cli/latest/userguide/cli-chap-getting-set-up.html) in the *Amazon Command Line Interface User Guide*.

1. Open a terminal.

1. 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"}'
   ```

# Creating a metrics configuration that filters by prefix, object tag, or access point
Filtering by prefix, object tag, or access point

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 for processing. Request metrics are billed at the standard CloudWatch rate. You must opt in to request metrics by configuring them in the console or using the Amazon S3 API. [S3 Replication metrics](https://docs.amazonaws.cn/AmazonS3/latest/userguide/viewing-replication-metrics.html) provide detailed metrics for the replication rules in your replication configuration. With replication metrics, you can monitor minute-by-minute progress by tracking bytes pending, operations pending, operations that failed replication, and replication latency.

For more information about CloudWatch metrics for Amazon S3, see [Monitoring metrics with Amazon CloudWatch](cloudwatch-monitoring.md). 

When you configure CloudWatch metrics, you can create a filter for all the objects in your bucket, or you can filter the configuration into groups of related objects within a single bucket. You can filter objects in a bucket for inclusion in a metrics configuration based on one or more of the following filter types:
+ **Object key name prefix** – Although the Amazon S3 data model is a flat structure, you can infer a hierarchy by using a prefix. The Amazon S3 console supports these prefixes with the concept of folders. If you filter by prefix, objects that have the same prefix are included in the metrics configuration. For more information about prefixes, see [Organizing objects using prefixes](using-prefixes.md). 
+ **Tag** – You can add tags, which are key-value name pairs, to objects. Tags help you find and organize objects easily. You can also use tags as filters for metrics configurations. For more information about object tags, see [Categorizing your objects using tags](object-tagging.md). 
+ **Access point** – S3 Access Points are named network endpoints that are attached to buckets and simplify managing data access at scale for shared datasets in S3. When you create an access point filter, Amazon S3 includes requests to the access point that you specify in the metrics configuration. For more information, see [Monitoring and logging access points](access-points-monitoring-logging.md).
**Note**  
When you create a metrics configuration that filters by access point, you must use the access point Amazon Resource Name (ARN), not the access point alias. Make sure that you use the ARN for the access point itself, not the ARN for a specific object. For more information about access point ARNs, see [Using Amazon S3 access points for general purpose buckets](using-access-points.md).

If you specify a filter, only requests that operate on single objects can match the filter and be included in the reported metrics. Requests like [https://docs.amazonaws.cn/AmazonS3/latest/API/multiobjectdeleteapi.html](https://docs.amazonaws.cn/AmazonS3/latest/API/multiobjectdeleteapi.html) and `ListObjects` requests don't return any metrics for configurations with filters.

To request more complex filtering, choose two or more elements. Only objects that have all of those elements are included in the metrics configuration. If you don't set filters, all of the objects in the bucket are included in the metrics configuration.

## Using the S3 console


1. Sign in to the Amazon Web Services Management Console and open the Amazon S3 console at [https://console.amazonaws.cn/s3/](https://console.amazonaws.cn/s3/).

1. In the left navigation pane, choose **General purpose buckets**

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

1. Choose the **Metrics** tab.

1. Under **Bucket metrics**, choose **View additional charts**.

1. Choose the **Request metrics** tab.

1. Choose **Create filter**.

1. In the **Filter name** box, enter your filter name. 

   Names can contain only letters, numbers, periods, dashes, and underscores.

1. Under **Filter scope**, choose **Limit the scope of this filter using a prefix, object tags, and an S3 Access Point, or a combination of all three**.

1. Under **Filter type**, choose at least one filter type: **Prefix**, **Object tags**, or **Access Point**.

1. To define a prefix filter and limit the scope of the filter to a single path, in the **Prefix** box, enter a prefix.

1. To define an object tags filter, under **Object tags**, choose **Add tag**, and then enter a tag **Key** and **Value**.

1. To define an access point filter, in the **S3 Access Point** field, enter the access point ARN, or choose **Browse S3** to navigate to the access point.
**Important**  
You cannot enter an access point alias. You must enter the ARN for the access point itself, not the ARN for a specific object.

1. Choose **Save changes**.

   Amazon S3 creates a filter that uses the prefix, tags, or access point that you specified.

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

   You have now created a filter that limits the request metrics scope by prefix, object tags, or access point. About 15 minutes after CloudWatch begins tracking these request metrics, you can see charts for the metrics on both the Amazon S3 and CloudWatch consoles. Request metrics are billed at the standard CloudWatch rate. For more information, see [Amazon CloudWatch pricing](https://www.amazonaws.cn/cloudwatch/pricing/). 

   You can also configure request metrics at the bucket level. For information, see [Creating a CloudWatch metrics configuration for all the objects in your bucket](configure-request-metrics-bucket.md).

## Using the Amazon CLI


1. Install and set up the Amazon CLI. For instructions, see [Installing, updating, and uninstalling the Amazon CLI](https://docs.amazonaws.cn/cli/latest/userguide/cli-chap-install.html) in the *Amazon Command Line Interface User Guide*.

1. Open a terminal.

1. To add a metrics configuration, run one of the following commands:  
**Example : To filter by prefix**  

   ```
   aws s3api put-bucket-metrics-configuration --bucket amzn-s3-demo-bucket --id metrics-config-id --metrics-configuration '{"Id":"metrics-config-id", "Filter":{"Prefix":"prefix1"}} '
   ```  
**Example : To filter by tags**  

   ```
   aws s3api put-bucket-metrics-configuration --bucket amzn-s3-demo-bucket --id metrics-config-id --metrics-configuration '{"Id":"metrics-config-id", "Filter":{"Tag": {"Key": "string", "Value": "string"}} '
   ```  
**Example : To filter by access point**  

   ```
   aws s3api put-bucket-metrics-configuration --bucket amzn-s3-demo-bucket --id metrics-config-id --metrics-configuration '{"Id":"metrics-config-id", "Filter":{"AccessPointArn":"arn:aws:s3:Region:account-id:accesspoint/access-point-name"}} '
   ```  
**Example : To filter by prefix, tags, and access point**  

   ```
   aws s3api put-bucket-metrics-configuration --endpoint https://s3.Region.amazonaws.com --bucket amzn-s3-demo-bucket --id metrics-config-id --metrics-configuration '
   {
       "Id": "metrics-config-id",
       "Filter": {
           "And": {
               "Prefix": "string",
               "Tags": [
                   {
                       "Key": "string",
                       "Value": "string"
                   }
               ],
               "AccessPointArn": "arn:aws:s3:Region:account-id:accesspoint/access-point-name"
           }
       }
   }'
   ```

## Using the REST API


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*:
+ [PUT Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketPUTMetricConfiguration.html)
+ [GET Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketGETMetricConfiguration.html)
+ [List Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTListBucketMetricsConfiguration.html)
+ [DELETE Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTDeleteBucketMetricsConfiguration.html)

# Deleting a metrics filter


You can delete an Amazon CloudWatch request metrics filter if you no longer need it. When you delete a filter, you are no longer charged for request metrics that use that *specific filter*. However, you will continue to be charged for any other filter configurations that exist. 

When you delete a filter, you can no longer use the filter for request metrics. Deleting a filter cannot be undone. 

For information about creating a request metrics filter, see the following topics:
+ [Creating a CloudWatch metrics configuration for all the objects in your bucket](configure-request-metrics-bucket.md)
+ [Creating a metrics configuration that filters by prefix, object tag, or access point](metrics-configurations-filter.md)

## Using the S3 console


1. Sign in to the Amazon Web Services Management Console and open the Amazon S3 console at [https://console.amazonaws.cn/s3/](https://console.amazonaws.cn/s3/).

1. In the left navigation pane, choose **General purpose buckets**.

1. In the buckets list, choose the name of the bucket you want to delete a request metrics filter for.

1. Choose the **Metrics** tab.

1. Under **Bucket metrics**, choose **View additional charts**.

1. Choose the **Request metrics** tab.

1. Choose **Manage filters**.

1. Choose your filter.
**Important**  
Deleting a filter cannot be undone.

1. Choose **Delete**.

   Amazon S3 deletes your filter.

## Using the REST API


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*:
+ [PUT Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketPUTMetricConfiguration.html)
+ [GET Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTBucketGETMetricConfiguration.html)
+ [List Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTListBucketMetricsConfiguration.html)
+ [DELETE Bucket Metric Configuration](https://docs.amazonaws.cn/AmazonS3/latest/API/RESTDeleteBucketMetricsConfiguration.html)