Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS : how to archive files from S3 to Glacier using only command line

I can't find a command example for archiving a set of files from a given prefix in S3 into a given vault in Glacier using ONLY COMMAND LINE, i.e. no Lifecycles, no python+boto. Thanks.

This doc has a lot of examples but none fit my request: https://docs.aws.amazon.com/cli/latest/reference/s3/mv.html

like image 393
SwissNavy Avatar asked Dec 10 '25 16:12

SwissNavy


2 Answers

You're looking for this:

https://aws.amazon.com/premiumsupport/knowledge-center/restore-s3-object-glacier-storage-class/

aws s3 cp s3://bucketname/key/file s3://bucketname/key/file --storage-class GLACIER

optionally use --recursive instead of a specific file name.

like image 156
Chwaee Avatar answered Dec 13 '25 04:12

Chwaee


That's because you can't. As described in the Amazon's S3 Documentation:

You cannot specify GLACIER as the storage class at the time that you create an object. You create GLACIER objects by first uploading objects using STANDARD, RRS, or STANDARD_IA as the storage class. Then, you transition these objects to the GLACIER storage class using lifecycle management.

like image 31
guest Avatar answered Dec 13 '25 04:12

guest