- 
                Notifications
    
You must be signed in to change notification settings  - Fork 870
 
Description
Currently, to generate a presigned url, the following code is used.
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest()
{
	BucketName = bucketName,
	Key = objectKey,
	Expires = expiryTime,
	Verb = HttpVerb.PUT,
};
When uploading a part, one must include an uploadId and partNumber as part of the query string. Since it is not possible to pass
that into the GetPreSignedUrlRequest, the url will result in a signature mismatch.
Possible Solution
Extend GetPreSignedUrlRequest  with properties UploadId and PartNumber, and include these values in the signature calculation
as part of the canonicalized query parameters.
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest()
{
	BucketName = bucketName,
	Key = objectKey,
	Expires = expiryTime,
	Verb = HttpVerb.PUT,
	UploadId = uploadId,
	PartNumber = partNumber
};
Context
Am creating a tool to allows users to upload large files to S3 and absolutely need multi-part support. I am leveraging lambda to generate each part URL on demand. To get it working, I had to import https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-examples-using-sdks.html#sig-v4-examples-using-sdk-dotnet to generate the signatures myself (all the signing stuff in the SDK is internal). While this works, I think it would be better if the SDK supported it out of the box.
Related items on the web of people with same or similar issue below. Seems this has been a need for a few years.
- https://stackoverflow.com/questions/20847196/amazon-s3-multipart-upload-using-query-string-authentication-and-net-sdk
 - https://stackoverflow.com/questions/37217532/is-there-a-net-library-that-can-sign-a-request-with-aws-v4-signature
 - https://stackoverflow.com/questions/42676885/aws-v4-signing-of-net-httpclient
 - http://gauravmantri.com/2014/01/06/create-pre-signed-url-using-c-for-uploading-large-files-in-amazon-s3/