Should I upload my files to S3 directly from the client or send them back to my server and upload them from there?
What are the pros and cons of each method? Which is more commonly done?
I’m using the MEAN stack, if that is relevant.
You can create signed upload URLs with the Amazon API. This will prevent unregistered users from uploading things to your bucket(s).
Your server creates the signed URL and returns this to the client. The client can then upload directly to S3 without bogging down the server. You will probably also want to use Amazon notification service to notify the server when the upload is completed so that you can update the database with the location of the newly saved upload.
Check out this question about how to
upload file from angularjs directly to amazon s3 using signed url