Search code examples
amazon-web-servicesamazon-s3storage-class-specifier

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

  • 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