Is it possible to call a lambda function at the end of some AWS Textract processing?
Asked
Active
Viewed 287 times
2 Answers
2
What you can do is to put the result of the AWS Textract processing in an S3 Bucket.
And then use a S3 trigger to invoke a Lambda function - https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html

BTL
- 4,311
- 3
- 24
- 29
-
1That is certainly an option, I was already aware, but thanks for mentioning it here. – Ricardo Peres Feb 03 '22 at 12:24
1
When you're using asynchronous StartDocumentAnalysis it's possible to give SNS notification channel as a parameter. After processing is finished, proper message will be published. Java example below. You also have to specify a proper role that will allow Textract to publish to SNS.
For synchronous processing you can trigger lambda manually.
Alternative solution would be to use S3 bucket to store result and add trigger there.
StartDocumentAnalysisRequest documentAnalysisRequest = StartDocumentAnalysisRequest.builder()
.documentLocation(DocumentLocation.builder()
.s3Object(document)
.build())
.featureTypes(List.of(FeatureType.TABLES))
.notificationChannel(NotificationChannel.builder()
.snsTopicArn(snsTopic) //topic for the message
.roleArn(role) //role with SNS publish permissions
.build())
.build();

thatninjadev
- 21
- 3