We can not change the default storage class of a Bucket in s3. By default, storage class in s3 is STANDARD. However, you could opt for different storage class during object upload operation in s3.
There are other options available which you could look for
- Add Life Cycle
- Modify Storage class of an Object
Add Life Cycle
You could add a Life cycle on the bucket with specific storage class transition rule. This would help you to automatically transition of objects to a different storage class. To Add a Life Cycle, follow below steps
1. Sign in to AWS Management Console (link) and open s3 Service
2. Select your bucket and go to Management
3. Click on Add Life Cycle rule
4. Add Life Cycle rule
Provide a name to your rule and in Add filter to limit scope to prefix/tags, you could specify a particular prefix where the Life cycle rule would be applied. Otherwise, for empty value the rule would be applied on entire bucket. Lets proceed with empty prefix/tags
5. Configure Storage Class Transition
Click on Current Version. For Current version of Objects, click on Add Transition
Select transition to Standard-IA after <N> Days after creation. The minimum days rule for transition to Standard-IA is 30 days. Lets proceed with this
6. Configure Expiration
Amazon s3 remove the object asynchronously when the object reaches the end of its lifetime. Amazon s3 provides an option to configure the expiration based on object current or previous version.
For current version, you need to select Expire current version of object. So that the current version of object would remove from <N> days from object creation.
For Previous version, all previous versions of object would be deleted after its expiration days.
Clean up expired object delete markers is supported for previous version only. You would be charged for the no of days you set for in your object expiration. Lets proceed with Current version for object current version expiration after 365 days (Minimum is 31 days) from the creation
7. Review and click on Save
You are all set with your bucket Lifecycle rule configuration.
Modify Storage class of an Object
You could modify storage class of an existing object or multiple objects selectively using s3UI or via AWS CLI, SDK’s.
Below snippet shows, 3 existing objects with STANDARD storage class. Now lets move the storage class to STANDARD-IA for all 3 objects
1. Select all objects and go to Action and click on Change Storage Class
2. Select the storage class and click on Save followed by Change
3. Verify the Storage Class
I hope this blog helps. Please comment below for any questions related to this blog.