Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New serverless pattern - kinesis-lambda-error-handling #1638

Conversation

marakere
Copy link
Contributor

@marakere marakere commented Sep 6, 2023

Effective consumer strategies for handling Kinesis Data Stream anomalies
The purpose of this pattern is to showcase on how to handle the consumer(AWS Lambda) failure when reading/processing the records from the Amazon Kinesis data stream.

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

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

@marakere your 'example-pattern.json' is missing some key fields, please review below and address any errors you have

  1. framework: framework is not one of enum values: CDK,SAM,Terraform,Serverless Framework,Terraform (with modules),Pulumi

If you need any help, take a look at the example-pattern file.

Make the changes, and push your changes back to this pull request. When all automated checks are successful, the Serverless DA team will process your pull request.

@marakere
Copy link
Contributor Author

marakere commented Sep 7, 2023

Replaced the value from framework from "AWS SAM" to "SAM".
Pushed the changes.

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

## How it works
![Reference Architecture](/images/kinesis-lambda-error-handling.jpg)
Copy link
Contributor

Choose a reason for hiding this comment

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

image not loading in the readme

We highly recommend to use [Amazon Kinesis Data Generator(KDG)](https://aws.amazon.com/blogs/big-data/test-your-streaming-data-solution-with-the-new-amazon-kinesis-data-generator/) for the high volume testing. The KDG makes it simple to send test data to your Amazon Kinesis stream or Amazon Kinesis Firehose delivery stream.

## Cleanup
sam delete
Copy link
Contributor

Choose a reason for hiding this comment

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

format as bash / code

./kinesis-producer/without-poison-pill-put-records.sh
```

- Navigate to AWS Console, and then to Cloudwatch, Log groups, select the log group and the latest Log stream
Copy link
Contributor

Choose a reason for hiding this comment

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

what about using sam logs to do this in the CLI? As these instructions are not quite clear of what we should be looking at.

./kinesis-producer/with-poison-pill-put-records.sh
```

- Cloudwatch logs shows that there was one invalid or poison message, so here the bisectonfailure was applied which lead Lambda to split the batch in half and resume each half separately. Maximum retry attempts and maximum record age limit the number of retries on a failed batch. As the retry limit is 5, it will retry 5 times, before the message is put to AWS SQS.
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, use sam logs to get the logs

@mavi888
Copy link
Contributor

mavi888 commented Sep 18, 2023

Few small comments, after those are fixed then i can merge it

@marakere
Copy link
Contributor Author

Thanks for the review comments.
Updated the README.md file and changes are pushed.

@mavi888 mavi888 merged commit 097e08a into aws-samples:main Oct 9, 2023
2 checks passed
@mavi888
Copy link
Contributor

mavi888 commented Oct 10, 2023

Thanks for submitting your pattern.
Now this pattern is public in Serverless land

https://serverlessland.com/patterns/kinesis-lambda-error-handling

You can share your pattern using this link :)

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.

2 participants