amazon-web-servicesamazon-s3aws-cli

With Amazon S3 Intelligent Tiering, how do you know which tier an object is in?


https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html says:

When you archive Amazon S3 objects to the S3 Glacier or S3 Glacier Deep Archive storage class, or when objects are archived to the S3 Intelligent-Tiering Archive Access or Deep Archive Access tiers, the objects are not accessible in real time.

I understand this, but how can you tell if an object is in the Archive Access or Deep Archive Access tiers? I've gone through much of the AWS S3 documentation and I can't seem to find this information. I'm writing a UI for S3 and want to display either a "download" or a "restore" button depending on which tier the object is in. I'm just starting development on this so I don't have any files in those two tiers yet and I can't wait 90 days before anything gets moved there.

When you do a list-objects request, you get the storage class for each item, which comes back as INTELLIGENT_TIERING, but it doesn't tell you which tier it is.

A comment on Testing S3 Intelligent Tiering says you can fake it by changing the storage class to Glacier, but I have my doubts that this is an accurate test because Glacier and Intelligent Tiering are two different storage classes, and it doesn't make sense that Intelligent Tiering objects would suddenly change their storage class.

Does anyone have any insight? Thanks in advance.

UPDATE FROM AMAZON: (tl;dr, this is not possible)

Unfortunately we cannot identify the access tier for an object stored in Intelligent Tiering class the only way to determine the access tier of an object in by identifying the access pattern of an object. The access pattern can be identified either by analyzing AccessLogs or a user can review access pattern using S3 Storage Lens.

Based on your requirement, the best option for you would be to keep Intelligent-Tiering Archive configuration disabled. With this config disabled the objects in Intelligent-Tiering class will not move in "Archive Access tier" and "Deep Archive Access tier". With this configuration you can create a logic in your application that if the object is in class "Intelligent-Tiering" then the download button will be enabled and user will be able to download the object.

Now for moving objects to "Glacier" and "Glacier Deep Archive" you can configure a life cycle rule. Lets say you can configure a life cycle rule to transition objects in "Intelligent-Tiering" class to Glacier after 90 days and to "Glacier Deep Archive" after 180 days.

This way using ListObjects API call you can identify the correct storage class of the objects and you can program a logic where the "Restore" button will only be enabled if the storage class is "Glacier" or "Glacier Deep Archive". Appropriately a message will be displayed to users to download the object after 3-5 hours.


Solution

  • @howcheng You can use S3 Inventory to get list of all of your objects and their corresponding metadata, including the S3 Intelligent-Tiering access tiers (Frequent, Infrequent, Archive, Deep Archive). Amazon S3 Inventory provides CSV, ORC, or Parquet output files that list your objects and their corresponding metadata on a daily or weekly basis for an S3 bucket or a shared prefix. You can also make a HEAD request on your objects to report the S3 Intelligent-Tiering archive access tiers.