AWS S3 – Etag Sha256 instead of Md5

Question:

I want to use Sha256 for the checksum of my objects.
But it looks like, that amazon uses md5 in the ETag.

Is there any workaround?

Answer:

Unfortunately, there’s no direct way to make S3 use SHA256 for ETag. You could use S3 metadata as a workaround. For this, you can calculate the SHA256 checksum yourself and use user defined S3 object metadata to set it for each upload. User defined metadata is just a set of key-value pairs you can assign to your object. You’ll have to set the checksum when you PUT your object and compare it on GET/HEAD object.

More information is available in the S3 documentation:

AWS – Object Key and Metadata

Leave a Reply