Reputation: 81
I am creating a web app where there is an option for authenticated users to upload pictures. I am confused as to whether its better to do it on the front end or backend. I have already implemented it on the front end but I had to include my "accessKeyId" and "secretKey". I don't know if this compromises my security. I am using cloud functions for my back end. If anyone can help me with best practices in relation to this I will be very grateful.
Upvotes: 8
Views: 7386
Reputation: 625
Frontend, say you have 1000 users, all upload via server, your server will have to do very heavy work. Just let the client do the upload
Upvotes: 0
Reputation: 365
You can generate pre-signed urls from your backend, then your frontend can upload files safely directly into S3 without exposing your credentials.
Take a look into the documentation here.
Also, this article points out some of the advantages of that strategy:
Upvotes: 13