Reputation: 1873
I want to build an API which accepts a file and text parameters together using multipart/form-data. AWS Lambda then performs operations on the file and returns some text. For example
curl -X POST \
http://my-endpoint.com \
-F lang=eng \
-F config=text \
-F image=@/home/myfile.jpg
#lang and config are text, image is file. Text is returned
I can build API gateway+lambda or API gateway+S3 APIs. But I'm not getting how to combine them in parallel for the desired effect.
Edit: By parallel I mean one API call starts this sequence-.
POST->save file in S3->read file in lambda->process using passed variables->response
Upvotes: 1
Views: 74
Reputation: 1780
There are a few options here that I can think of.
You can make the lambda function handle the S3 actions for you instead of integrating directly between API Gateway and S3.
Alternatively, you may be able to use web sockets to keep a connection open. The flow would be connect to API (Web socket established) -> POST to API GWAY + API -> s3 put triggers LAMBDA -> Lambda processes and responds via websock.
The first approach may be more achievable.
Upvotes: 1