简体   繁体   中英

How to Connect S3 to Amazon Textract using node js

I have been working on a project of my own, building OCR using AWS. My Main idea is to use node & express , I have successfully created upload page, I had kept a trigger whenever a POST request(File upload) to my S3 bucket comes I am sending a trigger notification to lambda and invoking it.....

I am not sure how to send my file to Amazon text extract … I would be very grateful if anyone give solution to my problem..

My use case:

User-> upload File(S3)->Amazon Text Extract -> SentimentAnalysis/KeyPhrasaes ->Logic ->Result.

This asynchronous flow will work for your case.

  • Trigger a lambda when an object is created in S3 bucket.(You upload file to this bucket) https://docs.aws.amazon.com/lambda/latest/dg/with-s3.html
  • When s3 event lambda is triggered, extract s3 bucket name and key from the payload and pass them to textract api calls using aws sdk.
  • AWS Textract publishes its status to AWS SNS, so you have 2nd lambda function subscribed to sns topic and pull textract result if sns message payload job was completed successfully.

Browser/Express backend -> S3(file upload) -> Lambda(Get S3 bucket & key) -> AWS Textract -> SNS -> AWS Lambda -> Your logic goes on after pulling textract result.

https://docs.aws.amazon.com/textract/latest/dg/API_StartDocumentAnalysis.html https://docs.aws.amazon.com/textract/latest/dg/API_StartDocumentTextDetection.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM