How to get the metadata of an AWS S3 object?

I upload files using the aws cli . But how to get the metadata of an object in AWS S3?

You can use the s3api‘s head-object command to get the metadata of an object.

Taking one example:

$ aws s3api head-object 
--bucket test-hkust 
--key dir2/fileupload/fb0c6353-a90c-4522-9355-7cd16cf756ff.file.txt

It will print results like

    "AcceptRanges": "bytes",
    "ContentType": "binary/octet-stream",
    "LastModified": "Sun, 24 Apr 2016 15:20:34 GMT",
    "ContentLength": 1560048,
    "ETag": ""7d67f2ca5ee7c75a642d22065542e447"",
    "Metadata": {}

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *