AWSCLI command to get object x-amz-id-2 AND List object having given object id / x-amz-id-2
Please advice which AWSCLI we can use to
- Get object id / x-amz-id-2 of single/multiple objects under a bucket
- Search and list object of ECS bucket having given object id / x-amz-id-2
Tried
- s3api head-object
- s3api get-object-tagging
- s3api list-objects-v2 But neither of these worked and the s3api head-object is showing below information. But, still not able to get x-amz-id-2 of objects.
Output of s3api head-object for single object as for this sub-command, we need to supply object path as key as its mandatory ->
{
"LastModified": "2024-03-05T22:50:58+00:00",
"ContentLength": 10365860,
"ETag": "\"f10b2d17dc*******4d12e141378f50\"",
"VersionId": "17096******12",
"ContentType": "application/octet-stream",
"Metadata": {}
}
If running this along with --debug then it has the response header which contains x-amz-id-2 and other relevant key-values but not sure how to get x-amz-id-2 only using any awscli command.
Extract of s3api head-object with --debug ->
2024-03-09 00:00:46,830 - MainThread - botocore.parsers - DEBUG - Response headers: {'Date': 'Fri, 08 Mar 2024 18:30:46 GMT', 'Server': '******.0', 'x-amz-request-id': '80*****b:18d*****60b:e***9:7*c', 'x-amz-id-2': '2e*******************208d6f4589bfce4a780492c534f5c1c105e4d3ab62', 'x-amz-version-id': '17096******12', 'ETag': '"f10b2d17dc*******4d12e141378f50"', 'Last-Modified': 'Tue, 05 Mar 2024 22:50:58 GMT', 'x-emc-mtime': '17096******12', 'Content-Type': 'application/octet-stream', 'Content-Length': '10365860'}
Below snap is from S3 Browser showing all these information under Headers tab: -
