An API which takes file and some parameters using POST and gives back a JSON response.
curl -X POST www.endpoint.com \
-F file=@/myfile.txt \
-F foo=bar # other params
I have this working with Lambda + API gateway using binary data but 10MB limit is the issue.
I have considered a POST API which uploads file to S3. The event generated is then read by Lambda. But for this I have few questions-
However, we can get around this limit by using an AWS S3 pre-signed url for uploads. This allows our AWS Lambda function to instead generate a pre-signed url and return it to our client, then our client can use that temporary pre-signed url to upload directly to our AWS S3 bucket.
128 MB to 10,240 MB, in 1-MB increments.
Your use case simply isn't possible with one API call if you want to stick with a serverless solution.
A possible serverless solution would be a 3 step process for the client.
Step 1
Call api1 to get a signed url for S3. This would point to a Lambda that creates a UUID and uses that UUID to construct a signed URL for S3 (i.e. uses the UUID as the filename of the file being received). The response would be the URL and the UUID.
Step 2
PUT file to s3 using the signed URL.
Step 3
Call api2 and pass the UUID and what ever other parameters are required. This api also points to a Lambda which now knows where the file is (thanks to the UUID) and has whatever other parameters are required to process the file and give a response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With