I am trying to upload an image to Amazon S3 using C#:
PutObjectRequest titledRequest = null;
S3Response response = null;
using (var memoryStream = new MemoryStream())
{
image.Save(memoryStream, ImageFormat.Png);
titledRequest = new PutObjectRequest();
titledRequest.WithBucketName(bucketName)
.WithKey(keyName)
.WithCannedACL(S3CannedACL.PublicRead)
.WithInputStream(memoryStream);
response = client.PutObject(titledRequest);
}
As you can see, I am not saving the image file locally but rather streaming it to S3. However, for some reason, this process takes around 50 seconds for a 50kb file!
There is nothing wrong with my upload speed its well over 1mbps.
I’m wondering is it faster to save the file first and upload?
Is there anything I should consider to speed up upload process? Again, no problems on the broadband side of things!
Amazon docs say:
Hard to believe this could be your problem, but a best practice you should follow.
Other things to consider –
your image?
send operation?