How to set the storage class for an S3 object using s3cmd?

To set the storage class for an S3 object using s3cmd, you can use the --storage-class option followed by the desired storage class. Here are the steps:

  1. Install and configure s3cmd if you haven't done so already. You can follow the instructions provided by s3cmd's official documentation for installation and configuration.

  2. Once you have s3cmd installed and configured, open a command prompt or terminal.

  3. Use the following command to set the storage class for the S3 object:

s3cmd modify s3://bucket-name/object-name --storage-class=desired-storage-class

Replace bucket-name with the name of your S3 bucket and object-name with the name of the object you want to modify.

  1. Replace desired-storage-class with the desired storage class you want to set for the object. The available storage classes in S3 are:
  • STANDARD: Standard storage class
  • REDUCED_REDUNDANCY: Reduced redundancy storage class (deprecated)
  • STANDARD_IA: Standard-IA (Infrequent Access) storage class
  • ONEZONE_IA: One Zone-IA (Infrequent Access) storage class
  • INTELLIGENT_TIERING: Intelligent-Tiering storage class
  • GLACIER: Glacier storage class

For example, to set the object's storage class to STANDARD_IA, use the command:

s3cmd modify s3://bucket-name/object-name --storage-class=STANDARD_IA
  1. Once you execute the command, s3cmd will modify the storage class for the specified object in your S3 bucket.