Menu
Amazon Simple Storage Service
API Reference (API Version 2006-03-01)

GET Bucket metrics

Description

Gets a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from the bucket. Note that this doesn't include the daily storage metrics.

To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration action. The bucket owner has this permission by default. The bucket owner can grant this permission to others. For more information about permissions, see Permissions Related to Bucket Subresource Operations and Managing Access Permissions to Your Amazon S3 Resources in the Amazon Simple Storage Service Developer Guide.

For information about CloudWatch request metrics for Amazon S3, see Monitoring Metrics with Amazon CloudWatch in the Amazon Simple Storage Service Developer Guide.

Requests

Syntax

Copy
GET /?metrics&id=id HTTP/1.1 Host: BucketName.s3.amazonaws.com x-amz-date: Thu, 15 Nov 2016 00:17:21 GMT Authorization: authorization string (see Authenticating Requests (AWS Signature Version 4))

Request Parameters

Parameter Description Required
id

The ID used to identify the metrics configuration.

Yes

Request Headers

This implementation of the operation uses only request headers that are common to all operations. For more information, see Common Request Headers.

Request Elements

This implementation of the operation does not use request elements.

Responses

Response Headers

The operation returns response headers that are common to most responses. For more information, see Common Response Headers.

Response Elements

The Examples section shows an example of a metrics configuration XML. The following table describes the XML elements in the metrics configuration returned by the GET request.

Name Description
And

A conjunction (logical AND) of predicates, which is used in evaluating a metrics filter. The operator must have at least two predicates, and an object must match all of the predicates in order for the filter to apply.

Type: Container

Children: Prefix, Tag

Ancestor: Filter

Filter

Specifies a metrics configuration filter. The metrics configuration only includes objects that meet the filter's criteria. A filter must be a prefix, a tag, or a conjunction (MetricsAndOperator).

Type: Container

Children: And

Ancestor: MetricsConfiguration

Id

The ID used to identify the metrics configuration.

Type: String

Ancestor: MetricsConfiguration

Key

The name of the tag.

Type: String

Ancestor: Tag

MetricsConfiguration

An existing metrics configuration for CloudWatch request metrics on this bucket.

Type: Container

Children: Filter, Id

Ancestor: None

Prefix

A string of text used at the beginning of an object key name.

Type: String

Ancestor: And

Tag

A key value name pair, used to organize objects by association.

Type: Container

Children: Key, Value

Ancestor: And

Value

The value of the tag.

Type: String

Ancestor: Tag

Special Errors

This implementation of the operation does not return special errors. For general information about Amazon S3 errors and a list of error codes, see Error Responses.

Examples

First Sample Request

Retrieve a metrics configuration that filters metrics based on a specified prefix.

Copy
GET /?metrics&id=Documents HTTP/1.1 Host: examplebucket.s3.amazonaws.com x-amz-date: Thu, 15 Nov 2016 00:17:21 GMT Authorization: signatureValue

First Sample Response

Retrieve a metrics configuration that filters metrics based on a specified prefix.

Copy
HTTP/1.1 200 OK x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp x-amz-request-id: 51991EXAMPLE5321 Date: Thu, 15 Nov 2016 00:17:22 GMT Server: AmazonS3 Content-Length: 180 <?xml version="1.0" encoding="UTF-8"?> <MetricsConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Id>Documents</Id> <Filter> <Prefix>documents/</Prefix> </Filter> </MetricsConfiguration>

Second Sample Request

Retrieve a metrics configuration that enables metrics for objects that start with a particular prefix and also have specific tags applied.

Copy
GET /?metrics&id=ImportantBlueDocuments HTTP/1.1 Host: examplebucket.s3.amazonaws.com x-amz-date: Thu, 15 Nov 2016 00:17:21 GMT Authorization: signatureValue

Second Sample Response

Retrieve a metrics configuration that enables metrics for objects that start with a particular prefix and also have specific tags applied.

Copy
HTTP/1.1 200 OK x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp x-amz-request-id: 51991EXAMPLE5321 Date: Thu, 15 Nov 2016 00:17:22 GMT Server: AmazonS3 Content-Length: 480 <?xml version="1.0" encoding="UTF-8"?> <MetricsConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Id>ImportantBlueDocuments</Id> <Filter> <And> <Prefix>documents/</Prefix> <Tag> <Key>priority</Key> <Value>high</Value> </Tag> <Tag> <Key>class</Key> <Value>blue</Value> </Tag> </And> </Filter> </MetricsConfiguration>