Looking hard at upgrading to aws-sdk-go-v2. Why d...
# dev
a
Looking hard at upgrading to aws-sdk-go-v2. Why does the S3 block adapter have
streamToS3
that hanldes its own HTTP request? What did v1 not offer in the interface that made us have to use our own client code?
b
Streaming request. Put without knowing the content length required seeker reader.
a
So length and sha256 hash?
b
This feature - x-amz-content-sha256: STREAMING-AWS4-HMAC-SHA256-PAYLOAD
g
If I remember correctly, the signature should be sent at the beginning of a request, when we receive data from a client, if he doesn’t send the sha256 hash of the request, we need to read the whole object and calculate it before sending.
a
Yeah... I'm seeing how to do that with sdk-v2, hopefully that's just it.
g
The v1 didn’t have any support for streaming requests. If streaming is supported with sdk-v2, we should definitely use it!
a
I don't see it, although https://github.com/aws/aws-sdk-go-v2/issues/343 says it would be a good idea (in 2019). Looking at the s3 upload manager, maybe it will like me a bit more.
Closest is https://aws.github.io/aws-sdk-go-v2/docs/sdk-utilities/s3/#putobjectinput-body-field-ioreadseeker-vs-ioreader, which AFAICT will still need read the file twice in order to compute the hash to sign.
So perhaps I can attach it as a middleware with https://aws.github.io/aws-sdk-go-v2/docs/middleware/#attaching-middleware-to-a-specific-operation ? Will see if placing length and digest values early enough will encourage PutObject to DTRT.
Yikes! https://github.com/aws/aws-sdk-go-v2/issues/1040 I am close to giving up on SDK v2, it might not be an improvement. We'll just have to get by without observable logs on S3 uploads.
b
From what I've seen the upload manager is good for client side when you don't want to work your way with upload/multipart upload better reuse of your client resources while uploading content. It will keep your code simple, but in this case we function as a proxy - streaming the request will always be our default choice and the I'm not sure they wrapped a version to do that in the generated sdk code.
a
Unfortunately you are correct. There is still no built-in way to stream uploads to S3 (the minio client doesn't do that, either). And content-length seems to be handled purely as an integer, which does not seem encouraging.
😞 1