0

I'm building my first web application and I've got a question around process and best practice, I'm hoping the expertise on this website might be give me a bit of direction.

Essentially, all the MVP is doing is going to be writing an overlay onto an image and presenting this back to the user, as follows;

  1. User uploads picture via web form (into AWS S3) - to do
  2. Python script executes (in lambda) and creates image overlay, saves new image back into S3 - complete
  3. User is presented back with new image to download - to do

I've been running this locally as sort of a proof of concept and was planning on linking up with S3 today but then suddenly realised, what happens when there are two concurrent users and two images being uploaded with different filenames with two separate lambda functions working?

The only solution I could think of is having the image renamed upon upload with a record inserted into an RDS, then the lambda function to run upon record insertion against the new image, which would resolve half of it, but then how would I get the correct image relayed back to the user?

I'll be clear, I have next to no experience in web development, I want the front end to be as dumb as possible and run everything in Python (I'm a data scientist, I can write Python for data analysis but no experience as a software dev!)

halfer
  • 19,824
  • 17
  • 99
  • 186
roastbeeef
  • 1,039
  • 1
  • 12
  • 23

1 Answers1

0

You don't really need an RDS, just invoke your lambda synchronously from the browser.

So

  1. Upload file to S3, using a randomized file name
  2. Invoke your lambda synchronously, passing it the file name
  3. Have your lambda read the file, convert it, and respond with either the file itself (binary responses aren't trivial), or a path to the converted file in S3.
Rob Conklin
  • 8,806
  • 1
  • 19
  • 23
  • Are you suggesting two lambda functions and two browser requests? Would it be better to do it in a single request? I am also trying to do the same as roastbeeef and can't find any examples to help. Related: https://github.com/serverless/examples/issues/106 – imbrizi Nov 23 '18 at 18:35