Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aws s3 metadata all keys

The only way to read the user-defined metadata on an s3 object it seems is using head-object.

AWS_PROFILE=development aws s3api head-object --bucket "xxx-development" --key 'my-object-key'

s3api list-objects let's you get all the objects in the bucket including being able to filter for required patterns in the keys using --query, but it doesn't give the user-defined metadata associated with those objects.

AWS_PROFILE=development aws s3api list-objects --bucket "xxx-development" --query 'Contents[?contains(Key, 'original')]'

Is there a way to get all the objects and associated user-defined metadata without enumerating all the objects and iterating through all of them and doing a head-object on each?

user-defined metadata keys help us categorize our uploads to give meaningful insights.

like image 979
Jay Avatar asked Sep 18 '25 06:09

Jay


1 Answers

Unfortunately, no. The GET Bucket (List Objects) Version 2 (as well as Version 1) do not return user-defined metadata for an object.

You'll have to use HEAD object on each object returned by GET Bucket.

like image 74
spg Avatar answered Sep 19 '25 20:09

spg