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

PUT Bucket tagging

Description

This implementation of the PUT operation uses the tagging subresource to add a set of tags to an existing bucket.

Use tags to organize your AWS bill to reflect your own cost structure. To do this, sign up to get your AWS account bill with tag key values included. Then, to see the cost of combined resources, organize your billing information according to resources with the same tag key values. For example, you can tag several resources with a specific application name, and then organize your billing information to see the total cost of that application across several services. For more information, see Cost Allocation and Tagging in About AWS Billing and Cost Management.

To use this operation, you must have permission to perform the s3:PutBucketTagging action. By default, the bucket owner has this permission and can grant this permission to others.

Requests

Syntax

The following request shows the syntax for sending tagging information in the request body.

Copy
PUT /?tagging HTTP/1.1 Host: BucketName.s3.amazonaws.com Date: date Authorization: authorization string (see Authenticating Requests (AWS Signature Version 4)) <Tagging> <TagSet> <Tag> <Key>Tag Name</Key> <Value>Tag Value</Value> </Tag> </TagSet> </Tagging>

Request Parameters

This implementation of the operation does not use request parameters.

Request Headers

Content-MD5 will be a required header for this operation.

Request Elements

Name Description Required
Tagging

Container for the TagSet and Tag elements.

Type: String

Ancestors: None

Yes
TagSet

Container for a set of tags

Type: Container

Ancestors: Tagging

Yes
Tag

Container for tag information.

Type: Container

Ancestors: TagSet

Yes
Key

Name of the tag.

Type: String

Ancestors: Tag

Yes
Value

Value of the tag.

Type: String

Ancestors: Tag

Yes

Responses

Response Headers

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

Response Elements

This operation does not return response elements.

Special Errors

  • InvalidTagError - The tag provided was not a valid tag. This error can occur if the tag did not pass input validation. See the CostAllocation docs for a description of valid tags.

  • MalformedXMLError - The XML provided does not match the schema.

  • OperationAbortedError - A conflicting conditional operation is currently in progress against this resource. Please try again.

  • InternalError - The service was unable to apply the provided tag to the bucket.

Examples

Sample Request: Add tag set to a bucket

The following request adds a tag set to the existing examplebucket bucket.

Copy
PUT ?tagging HTTP/1.1 Host: examplebucket.s3.amazonaws.com Content-Length: 1660 x-amz-date: Thu, 12 Apr 2012 20:04:21 GMT Authorization: authorization string <Tagging> <TagSet> <Tag> <Key>Project</Key> <Value>Project One</Value> </Tag> <Tag> <Key>User</Key> <Value>jsmith</Value> </Tag> </TagSet> </Tagging>

Sample Response

Copy
HTTP/1.1 204 No Content x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo x-amz-request-id: 236A8905248E5A01 Date: Wed, 01 Oct 2012 12:00:00 GMT