Learning about S3's versatility continues as we focus on Amazon S3's multi-part upload feature. Implementing this feature with Boto3
will demonstrate the efficient handling of large files. By the end of this lesson, you will be more adept at managing sizable data sets.
The ability to divide a file into manageable components facilitates a more efficient upload process. This is particularly useful when transferring large files or when experiencing unstable network connectivity. Amazon S3 recommends using multi-part uploads for files larger than 100 MB, but it becomes a requirement for files exceeding 5 GB. Please note that the use of an S3 client, not an S3 resource, is necessary for performing multi-part uploads.
To begin a multi-part upload, you need to create a multi-part upload session. Here is how you initiate a session and define the parts:
Next, we calculate the number of parts and read those parts one by one. The size of each part, except the last, should be at least 5 MB and not more than 5 GB.
After all the parts have been uploaded, you need to indicate that the upload process is complete:
We delved into Amazon S3's multi-part upload functionality and executed these features using Boto3
. By understanding multi-part uploads, we can handle the upload of large files more effectively. Expect some fun exercises ahead where we get our hands dirty with multi-part uploads.
