I need to change storage class of a s3 object from STANDARD class into STANDARD_IA using s3cmd. Can anybody help me to do this task. Thanks in advance.
Asked
Active
Viewed 1.9k times
8
-
is it possible to do that with boto3? – Nic Wanavit Mar 22 '21 at 02:02
2 Answers
14
If you want to change the storage class on all objects within a bucket use:
aws s3 cp s3://<bucket-name>/ s3://<bucket-name>/ --recursive --storage-class <storage_class>
--storage-class (string) The type of storage to use for the object. Valid choices are: STANDARD | REDUCED_REDUNDANCY | STANDARD_IA | ONEZONE_IA | INTELLIGENT_TIERING | GLACIER | DEEP_ARCHIVE. Defaults to 'STANDARD'
Source: cp @ AWS CLI Command Reference

BinaryButterfly
- 18,137
- 13
- 50
- 91

dpatryas
- 409
- 4
- 13
10
Using s3cmd:
s3cmd cp s3://BUCKET/KEY s3://BUCKET/KEY --storage-class=STANDARD_IA
Using AWS CLI:
aws s3 cp s3://BUCKET/KEY s3://BUCKET/KEY --storage-class STANDARD_IA
WARNING: If Versioning is on, this does not change the storage class of the object. It creates a new object with the requested storage class (e.g. STANDARD_IA), but keeps the original version in whatever storage class it was uploaded (e.g. STANDARD). You'll be paying for both copies.

Alan W. Smith
- 24,647
- 4
- 70
- 96

Mark B
- 183,023
- 24
- 297
- 295
-
s3cmd: error: no such option: ----storage-class error shows when i tried the given command – Gugan Abu Mar 22 '16 at 05:13
-
@Gugan sorry, I had a typo in my answer, only 2 dashes needed. See my updated answer. – Mark B Mar 22 '16 at 05:38
-
-
Maybe you have an old version of s3cmd? I'm basically just reading the documentation for you. You can read it yourself here: http://s3tools.org/usage – Mark B Mar 22 '16 at 13:40
-
You can also use the following to move the copies between storage types `s3cmd mv s3://BUCKET/KEY s3://BUCKET/KEY --storage-class=STANDARD_IA` – john Nov 03 '16 at 11:11
-
I'm going to add here that both "aws s3 mv" and "aws s3 cp" will modify your metadata on the object, so be prepared. However, the web console's Change Class action keeps the metadata intact. – gilm Aug 27 '20 at 08:46
-
using CP will consume a lot resources using daily basis, I wonder if will charge extras... – Wellington Oliveira Apr 23 '21 at 19:48
-
1@WellingtonOliveira this is a really old post. The best way to do this today, if you have so many objects to change that you are worried about the extra API costs, is to use a lifecycle rule instead. – Mark B Apr 23 '21 at 20:16