Skip to content

Conversation

@abilashkumar
Copy link
Contributor

@abilashkumar abilashkumar commented Dec 25, 2024

Issue #, if available: #2565

Description of changes:
This is a new PR created for a new serverless pattern that involves S3, Eventbridge, Lambda and Rekognition deployed using SAM that detects text in an image.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@abilashkumar abilashkumar changed the title new pattern:rekognition-s3-detecttext-python new serverless pattern:rekognition-s3-detecttext-python Dec 25, 2024
@abilashkumar abilashkumar changed the title new serverless pattern:rekognition-s3-detecttext-python new serverless pattern - rekognition-s3-detecttext-python Dec 25, 2024
@biswanathmukherjee
Copy link
Contributor

These 4 patterns are same except the API call within the Lambda function code. Only one of them can be allowed. Please code the rest.

#2570
#2564
#2568
#2566

{
"title": "S3 to Rekognition using EventBridge",
"description": "SAM template for S3 trigger to invoke the Lambda function through an EventBridge rule for detection text in an image with Rekognition",
"language": "python",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python


## How it works

The Cloudformation template creates 2 S3 buckets (source and destination buckets) along with a Lambda function (Python) and an EventBridge event. The Lambda function is triggered by the EventBridge which listens to an object upload in the S3 bucket. The lambda function makes a DetectText API call to detect the text in an image and stores the output in the destination S3 bucket.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SAM template creates two S3 buckets (source and destination buckets) along with a Lambda function (Python) and an EventBridge rule. The Lambda function is triggered by s3 bucket object upload event. The Lambda function makes Rekognition DetectText API call to detect the text in an image and stores the output in the destination S3 bucket.


1. Delete the stack
```bash
aws cloudformation delete-stack --stack-name STACK_NAME
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are old way of doing it. Use sam delete command. Also prior to deleting stack add commands to delete the contents from the bucket.

@@ -0,0 +1,66 @@
# Amazon S3 to Amazon Rekognition through AWS EventBridge
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS EventBridge --> Amazon EventBridge

```

Replace the parameters in the above command appropriately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a step for what to validate in the output bucket

@@ -0,0 +1,66 @@
# Amazon S3 to Amazon Rekognition through AWS EventBridge

This pattern demonstrates how to create an S3 bucket which when uploaded with an object invokes a Lambda function through EventBridge. The function detects the text in a document through Amazon Rekognition. The lambda function is built using Python.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lambda function --> Lambda function


Once you have run `sam deploy --guided` mode once and saved arguments to a configuration file (samconfig.toml), you can use `sam deploy` in future to use these defaults.

1. Note the outputs from the SAM deployment process. These contain the resource names and/or ARNs which are used for testing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sequence numbers 1, 2, 3.... :)

@biswanathmukherjee
Copy link
Contributor

After internal review, it is decided that PR 2568 will be allowed for further review. Hence closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants