Retrieving object metadata from directory buckets
The following AWS SDK and AWS CLI examples show how to use the HeadObject
and GetObjectAttributes
API operation to retrieve metadata from an object in an Amazon S3 directory bucket without
returning the object itself.
The following head-object
example command shows how you can use the AWS CLI to
retrieve metadata from an object. To run this command, replace the
with your own information.user input placeholders
aws s3api head-object --bucket
bucket-base-name
--zone-id
--x-s3 --keyKEY_NAME
For more information, see head-object
The following get-object-attributes
example command shows how you can use the AWS CLI to
retrieve metadata from an object. To run this command, replace the
with your own information.user input placeholders
aws s3api get-object-attributes --bucket
bucket-base-name
--zone-id
--x-s3 --keyKEY_NAME
--object-attributes "StorageClass" "ETag" "ObjectSize"
For more information, see get-object-attributes