I know there are two methods available to upload files in AWS S3 (i.e. PutObject and TransferUtility.Upload). Can someone please explain which one to use?
FYI, I have files ranging from 1kb to 250MB.
Thanks in advance.
Amazon deprecated the S3 Transfer Manager and migrated to the new Transfer Utility.The Transfer Utility is a simple interface for handling the most common uses of S3.It has a single constructor, which requires an instance of AmazonS3Client. Working with it is so easy and let the develpers perform all operations with less code.
Following are key features of using Transfer Utility over Transfer Manager
transferUtility.upload(MY_BUCKET,OBJECT_KEY,FILE_TO_UPLOAD) transferUtility.download(MY_BUCKET,OBJECT_KEY,FILE_TO_UPLOAD)
Note : Every thing else is good.But Transfer Utility does not support a copy() API.To accomplish it use AmazonS3Client class copyObject() method.
Based in Amazon docs, I would stick with TransferUtility.Upload
:
Provides a high level utility for managing transfers to and from Amazon S3.
TransferUtility provides a simple API for uploading content to and downloading content from Amazon S3. It makes extensive use of Amazon S3 multipart uploads to achieve enhanced throughput, performance, and reliability.
When uploading large files by specifying file paths instead of a stream, TransferUtility uses multiple threads to upload multiple parts of a single upload at once. When dealing with large content sizes and high bandwidth, this can increase throughput significantly.
But please be aware of possible concurrency issues and the recommendation about using BeginUpload (the asynchronous version), like in this related post
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With