I have developed an application that generates large files (700mb+) by using data from MySQL and then serves them to users.
I am now migrating the app to Heroku.
In order to upload a file to Amazon S3, that file has to be generated in the filesystem first or can be uploaded as a string since Heroku can't guarantee your file will be there (dyno might restart or fail for whatever reason).
Files are going to be pretty big so multipart upload will be used (I am not sure if string uploading can be done in parts).
I don't know if my plan is going to work correctly, or if there is a better way of doing this. What is something goes wrong and the dyno fails during the request?
How I think it should work: Let's assume that the app has started fetching data from database, generates a 5MB string and sends it to AWS, and loops through the dataset until the complete file is sent.