Questions about aws s3api put-object
I have a situation where I need to upload multiple files to s3. Some of these files are greater than 100 MB in size. Each file has a unique S3 destination. By unique, I mean same bucket but different folder.
The current implementation uses
aws s3api put-object
and uploads the files sequentially. This is of course very time consuming. I want to make the process fast and hence introduce some sort of parallelism by specifying multiple files to upload in same command (if that is possible) and/or using multiple threads to perform the upload command. What are the best practices I can follow. I am looking answers to the following questions:
- Can I upload file greater than 100MB in size using aws s3api put-object ? http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html mentions to use Multipart upload for file greater than 100 MB.
- Can I specify multiple files and their corresponding destinations in aws s3api put-object command? If yes, then is there a limit on number of files that I can specify or the total size of all files? http://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html does not seem to contain any such option.
Just curious, was there a reason you can't use aws s3 cp (http://docs.aws.amazon.com/cli/latest/reference/s3/cp.html)? If will automatically handle multipart uploading your file, and is multithreaded. It can also handle recursive uploads which will automatically upload multiple files in parallel (as well as doing multipart uploads for each individual file in parallel). In general you'll see much quicker uploads that using the low level aws s3api put-object.
But to answer your questions:
- Yes you can. The maximum file size you can upload with a single put-object call is 5GB.
- No you cannot, the underlying S3 API does not support this functionality.
I did not know much about the
aws s3 cp
command.
However, aws s3api put-object provided the option of specifying --content-md5 to be able to verify if the upload to s3 was success. I do not see this option with s3 cp command. How can I go about achieving end to end verification with s3 cp ? would that work with recursive upload as well?
Basically, I want to be able to detect any failures in upload(or any part of it) and retry. Or does this library provide these options out of the box as well?