Reputation: 927
I am trying to upload very heavy files on s3. Right now the image first go to server temp, then i am uploading the same to s3. But this process is time taking and if multiple users are uploading heavy images at the same time, it is consuming high bandwidth which is affecting the production site. Given i have 3 more sizes to be uploaded, hence i am resizing the uploaded image the sending the other 3 resized images to s3 along with this.
I researched on this and found out these 3 possible solutions..
So my question here is will it save the time for uploading an heavy image using 3rd option? I can send image encoded to server, but will it save user some time to upload?
If not, then what else i can do to save time and bandwidth of server while uploading heavy images to s3. Please help.
Upvotes: 2
Views: 829
Reputation: 981
I'm not sure if you have done this yet, but I have used the javascript sdk to do this, I was doing what you where doing by saving the images on another server and then shifting them to s3, but with the javascript sdk you can go directly to s3, you can add events to process the images after they arrive.
I hope this helps.
Upvotes: 0
Reputation: 269340
If at all possible, you should upload directly to Amazon S3. This avoids 'double-handling' of the files and is a much more scalable solution.
You are concerned about "exposing AWS keys". There is no need to be concerned. You can generate temporary, time-limited credentials with a limited set of permissions using the Security Token Service. It works this way:
The key concept with AWS is to design for massive scale. Uploading directly to Amazon S3 makes this possible, whereas uploading to your own server first causes a bottleneck (and costs more money!).
Upvotes: 2
Reputation: 19563
Number 2 is actually the recommend option when dealing with image processing. You can also use Lambda functions to do the image conversion. (http://docs.aws.amazon.com/lambda/latest/dg/walkthrough-s3-events-adminuser.html)
The job will be triggered as soon as an image is added to a specific S3 bucket.
If need be, you can also upload images directly to S3 (http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingHTTPPOST.html)
Upvotes: 1