lambda function for image detection

0

I would like to pass a image from a react web through cloud (lambda function) for image detection and return a json message of the detected result. But I have no idea how to send and recieve a message. How can I do that? Is it possible to de that without saving the image to a database?

질문됨 일 년 전229회 조회
2개 답변
1

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:

  1. 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.
  2. 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).

profile pictureAWS
답변함 일 년 전
0

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.

profile pictureAWS
micah
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠