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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With