View a markdown version of this page

Setting the default storage class for a bucket - Amazon Simple Storage Service

Setting the default storage class for a bucket

By default, a general purpose bucket uses S3 Standard (STANDARD) as its default storage class. You can change the bucket default to S3 Intelligent-Tiering (INTELLIGENT_TIERING) or S3 Standard at any time. Amazon S3 uses the bucket default for every new object that you write without the x-amz-storage-class request header.

The bucket 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. To move existing objects to S3 Intelligent-Tiering, add an S3 Lifecycle configuration that transitions them. For more information, see Transitioning objects using Amazon S3 Lifecycle.

How Amazon S3 applies the bucket default storage class

Amazon S3 applies the bucket default storage class as follows:

  • New object uploads – PutObject, POST Object, and CreateMultipartUpload requests use the bucket default storage class when the request doesn't include the x-amz-storage-class header. If the request includes the header, Amazon S3 uses the storage class in the header.

  • Copies – A CopyObject request without the x-amz-storage-class header uses the default storage class of the destination bucket, not the storage class of the source object. To keep the source storage class, specify it in the request. This also applies to Amazon S3 Batch Operations copy jobs.

  • Multipart uploads – Amazon S3 sets the storage class of a multipart upload when you create the upload. If you change the bucket default while an upload is in progress, the upload keeps the storage class it started with.

  • Replication – Replicas keep the storage class of the source object, or the storage class that you specify in the replication configuration. Replicas don't use the default storage class of the destination bucket. For more information, see Replication configuration file elements.

  • S3 Lifecycle – Your lifecycle rules apply to these objects the same way they apply to any other object.

Note

Some AWS services specify a storage class when they write objects to your bucket. These objects use the storage class that the service specifies, not the bucket default. To use the bucket default, check the storage class settings of the service.

To set the bucket default storage class, you need the s3:PutBucketDefaultStorageClass permission. To view it, you need the s3:GetBucketDefaultStorageClass permission. For more information, see Required permissions for Amazon S3 API operations.

How to set the default storage class

To set the default storage class for a bucket, you can use the following methods.

To set the default storage class for a bucket in the console:

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

  2. In the left navigation pane, choose General purpose buckets.

  3. In the buckets list, choose the name of the bucket that you want to change.

  4. Choose the Properties tab.

  5. Under Default storage class, choose Edit.

  6. Choose S3 Intelligent-Tiering or S3 Standard.

  7. Choose Save changes.

In the following examples, replace amzn-s3-demo-bucket1 with the name of your bucket.

The following AWS CLI command uses put-bucket-default-storage-class to set the default storage class of the bucket to S3 Intelligent-Tiering:

aws s3api put-bucket-default-storage-class --bucket amzn-s3-demo-bucket1 --default-storage-class-configuration DefaultStorageClass=INTELLIGENT_TIERING

The following AWS CLI command uses get-bucket-default-storage-class to view the default storage class of the bucket:

aws s3api get-bucket-default-storage-class --bucket amzn-s3-demo-bucket1

To set the bucket default storage class, use the PutBucketDefaultStorageClass API operation. To view it, use the GetBucketDefaultStorageClass API operation. The request body for PutBucketDefaultStorageClass uses the following format:

<DefaultStorageClassConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <DefaultStorageClass>INTELLIGENT_TIERING</DefaultStorageClass> </DefaultStorageClassConfiguration>

To set the bucket default storage class with CloudFormation, use the DefaultStorageClass property of the AWS::S3::Bucket resource:

MyBucket: Type: AWS::S3::Bucket Properties: DefaultStorageClass: INTELLIGENT_TIERING