- Newest
- Most votes
- Most comments
For me it depends on the image file size.
If you retrieve small images (< 6 MB), you can go directly with the following:web client => API Gateway => Lambda (your image detection code) => API Gateway => web client
. API Gateway will expose your Lambda function as a REST API.
If the images can be bigger, you will need to do it in 2-steps:
- Upload it to Amazon S3. You can do it directly from your client (for example using Amplify), or you can use pre-signed url. You can find a great article here. Return the pre-signed URL and a key (name of the S3 object) to the web client. The web client will use the URL to upload the file.
- Then you can do just like the first option (
web client => API Gateway => Lambda (your image detection code) => API Gateway => web client
) but instead of passing the file itself, you pass the key to the S3 object and your Lambda will have to retrieve it from S3 with the SDK.
Note that you will need to protect the S3 bucket and provide your users permissions to upload to it (using Cognito).
Hi there,
Can you provide a little more detail about your architecture?
It sounds like you have a React based web application, and you'd like to use it to send an image to Lambda for image processing. Are you already using an API Gateway to deliver the image payload to Lambda?
If all you are doing is some basic image processing, you can process the image within the Lambda function, and return the result as JSON to your React app via API Gateway. You would only need to use a database if you need to save the state/results of that image processing routine for use at another time.
Relevant content
- asked a year ago
- asked 9 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 days ago