How to get the metadata of an AWS S3 object?

I upload files using the aws cli http://www.systutorials.com/239665/uploading-large-files-amazon-s3-aws-cli/ . But how to get the metadata of an object in AWS S3?

asked May 8, 2016 by anonymous

1 Answer

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": {}
}
answered Jun 26, 2016 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...