'How to get the storage class of an object stored in aws bucket

I need to check the storage class of an object inside an S3 bucket.

Is there a way to get the storage class of an S3 object using the AWS CLI v2?



Solution 1:[1]

You could use list-objects-v2.

For example:

aws s3api list-objects-v2 --bucket <bucket-name> --prefix <object_key> --query "Contents[*].StorageClass" --output text

Output:

GLACIER

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcin