View a markdown version of this page

PutBucketDefaultStorageClass - Amazon S3

PutBucketDefaultStorageClass

Note

This operation is not supported for directory buckets.

Sets the default storage class of the general purpose bucket. Amazon S3 uses the default storage class for new objects that you write to the bucket without the x-amz-storage-class request header. A storage class that you specify on the write request takes precedence over the bucket default. For more information, see Setting the default storage class for a bucket in the Amazon S3 User Guide.

Changing the default storage class applies only to objects that you write after you change it. Amazon S3 doesn't change the storage class of objects that are already in the bucket. There is no operation to delete the default storage class. To revert the bucket to its original default, set the storage class to STANDARD.

To use this operation, you must have the s3:PutBucketDefaultStorageClass permission.

The following operations are related to PutBucketDefaultStorageClass:

Request Syntax

PUT /?default-storage-class HTTP/1.1 Host: Bucket.s3.amazonaws.com Content-MD5: ContentMD5 x-amz-sdk-checksum-algorithm: ChecksumAlgorithm x-amz-expected-bucket-owner: ExpectedBucketOwner <?xml version="1.0" encoding="UTF-8"?> <DefaultStorageClassConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <DefaultStorageClass>string</DefaultStorageClass> </DefaultStorageClassConfiguration>

URI Request Parameters

The request uses the following URI parameters.

Bucket

The name of the general purpose bucket.

Required: Yes

Content-MD5

The MD5 hash of the PutBucketDefaultStorageClass request body.

For requests made using the AWS Command Line Interface (CLI) or AWS SDKs, this field is calculated automatically.

x-amz-expected-bucket-owner

The AWS account ID of the general purpose bucket's owner.

x-amz-sdk-checksum-algorithm

Indicates the algorithm that you want Amazon S3 to use to create the checksum. For more information, see Checking object integrity in the Amazon S3 User Guide.

Valid Values: CRC32 | CRC32C | SHA1 | SHA256 | CRC64NVME | SHA512 | MD5 | XXHASH64 | XXHASH3 | XXHASH128

Request Body

The request accepts the following data in XML format.

DefaultStorageClassConfiguration

Root level tag for the DefaultStorageClassConfiguration parameters.

Required: Yes

DefaultStorageClass

The default storage class of the general purpose bucket. Valid values are STANDARD and INTELLIGENT_TIERING.

Type: String

Valid Values: STANDARD | INTELLIGENT_TIERING

Required: Yes

Response Syntax

HTTP/1.1 200

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: