amazon-s3aws-powershell

How to get checksums of each part of a multipart upload (AWS S3) via AWS Tools for PowerShell?


I'm trying to calculate and compare the hash of a multipart file that was uploaded via S3's Web UI. In order to do that, I need the hashes of each part.

I have tried this:

$s3Object | Get-S3ObjectAttribute -ObjectAttributes Checksum,ObjectParts -Select ObjectParts

Which returns this:

IsTruncated          : False
MaxParts             : 1000
NextPartNumberMarker : 9
PartNumberMarker     : 0
Parts                : {}
TotalPartsCount      : 9

As you can see the number of parts is correctly returned but "Parts" is empty. It should return the part index, hash information, etc of each part.

This article isn't using PowerShell but shows an example of how a list of parts should be returned. One difference between their example and what I've done is they did not do their upload via web portal. I'm starting to think that might be the reason. I don't currently have the means to create a multipart upload in another way to verify.

Has anybody else been able to get this to work?

Documentation:

Checksums on Multipart uploads

Get-S3ObjectAttribute Cmdlet

GetObjectAttributesResponse

GetObjectAttributesParts


Solution

  • There appears to be a bug in the AWS .NET SDK (which AWS Tools for PowerShell builds upon) where the Parts collection is failing to be unmarshalled correctly.

    https://github.com/aws/aws-sdk/issues/441

    You have the correct syntax by specifying -ObjectAttributes Checksum,ObjectParts on the Get-S3ObjectAttribute call, and that command should work once the underlying bug is addressed.

    Edit: This bug should now be fixed in AWS Tools for PowerShell version 4.1.328.0 released on 2023-05-05.