2

I'm required to archive around 200 AWS S3 buckets to S3 Glacier and I would like to do it automatically but I can't find how it can be done with aws-cli.

The only method I found, is through AWS UI... to go to each bucket manually and within it, to mark each directory -> right click and choose "change storage type" and choose Glacier.

Does anyone have any experience with this?

Itai Ganot
  • 10,976

3 Answers3

3

You could also set up lifecycle policies on the buckets so that they automatically transition to Glacier after x amount of days:

https://docs.aws.amazon.com/AmazonS3/latest/user-guide/create-lifecycle.html

Mugurel
  • 923
3
$ aws s3 cp s3://bucketname s3://bucketname --recursive --storage-class GLACIER

Be aware that there is a cost to transition objects to the Glacier storage class (approximately US$0.05 per 1,000 transition requests, dependent on region, so changing 1,000,000 objects to Glacier would cost approximately US$50).

neuro
  • 395
  • 2
  • 8
1

I think aws cli with s3 ls, s3 mv and --storage-class should do the job.

https://docs.aws.amazon.com/cli/latest/reference/s3/ls.html

https://docs.aws.amazon.com/cli/latest/reference/s3/mv.html

It should be possible to use the same source and destination with mv.

hargut
  • 3,948