Home > Enterprise >  Using S3 Glacier Instant Retrieval from AWS CLI
Using S3 Glacier Instant Retrieval from AWS CLI

Time:12-09

I read about the new storage class S3 Glacier Instant Retrieval and I want to use it when I upload files to S3 using the AWS CLI (command line interface). I read on https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html that the storage class options are:

--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’

How do I use the S3 Glacier Instant Retrieval storage class with the CLI and do I need to install a specific version of AWS CLI?

CodePudding user response:

CHANGELOG of aws-cli says updated in 2.4.4 version.

2.4.4

api-change:s3: Introduce Amazon S3 Glacier Instant Retrieval storage class and a new setting in S3 Object Ownership to disable ACLs for bucket and the objects in it.

(Document does not seem to be updated yet, though.)

CodePudding user response:

AWS seems to have only made it available through the S3 API-Level Commands at this time with aws s3api put-object.

When using put-object, you have the choice of using the --storage-class of GLACIER_IR. Tested this the other day for a blog post, which worked a treat. Why they haven't included it in s3 is a mystery to me.

aws s3api put-object --bucket mybucket --key folder/filename --body file --storage-class GLACIER_IR

This is the case as of aws-cli/2.4.5, but I can also see a Pull Request in the GitHub repo where someone has submitted a change to add it to aws s3, so this answer may change.

  • Related