What’s the best way to add file uploads to my website with AWS?

0
8
Asked By CuriousCat2023 On

Hey everyone! I'm looking for some advice on adding file upload functionality to my website. Currently, users can log in, but we don't have any way for them to upload files. I have a couple of options in mind using AWS S3. Option 1 is a direct upload approach where the backend handles everything, and the S3 bucket isn't public. Option 2 involves using AWS pre-signed URLs, which would allow uploads directly from the browser to S3, possibly resulting in faster uploads and less load on the backend. However, I've heard that Option 2 could be trickier to implement. I'm just looking for thoughts on which option might be better, including the pros and cons of each. Thanks for your help!

4 Answers

Answered By DevGuru101 On

Going with pre-signed URLs is the smarter move here. They offer a good balance of security and performance, making them a popular choice among developers.

Answered By TechSavvy88 On

If you're leaning toward Option 2, here's how it generally works: your frontend sends some parameters to a backend endpoint that uses AWS libraries to generate a pre-signed URL. The frontend then takes that URL and uploads the file directly to S3. This can introduce some complexity, but it’s often worth it for the performance gains and security.

FileFanatic24 -

Totally agree! Pre-signed URLs are the way to go for most cases.

Answered By CloudWizard99 On

I definitely recommend Option 2! It keeps your S3 bucket secure and your server free from heavy file load. Plus, there are some great libraries to help you manage this, like Uppy. Check it out for some client-side support!

UploadEnthusiast1 -

Yes, Uppy is fantastic for handling uploads efficiently!

Answered By CodeNinja7 On

Option 2 is the best choice in most situations. It reduces backend processing and keeps your bucket private. Just ensure you handle validations correctly on your server side to keep everything secure.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.