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

1.3k Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

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