Use HeadObject
with an AWS SDK or CLI
The following code examples show how to use HeadObject
.
- AWS CLI
-
The following command retrieves metadata for an object in a bucket named
amzn-s3-demo-bucket
:aws s3api head-object --bucket
amzn-s3-demo-bucket
--keyindex.html
Output:
{ "AcceptRanges": "bytes", "ContentType": "text/html", "LastModified": "Thu, 16 Apr 2015 18:19:14 GMT", "ContentLength": 77, "VersionId": "null", "ETag": "\"30a6ec7e1a9ad79c203d05a589c8b400\"", "Metadata": {} }
-
For API details, see HeadObject
in AWS CLI Command Reference.
-
For a complete list of AWS SDK developer guides and code examples, see Developing with Amazon S3 using the AWS SDKs. This topic also includes information about getting started and details about previous SDK versions.