Amazon MSK to AWS Lambda

Amazon MSK → AWS Lambda

Create a Lambda function that subscribes to an MSK topic

This pattern deploys a Lambda function that uses an Amazon MSK topic as an event source.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/msk-lambda

Deploy

sam deploy --guided


Testing

1. Publish messages to the Amazon MSK topic. Follow the steps as outlined in Step 4 to create a client machine and publish messages to the MSK Topic.
2. Retrieve the logs from the Lambda function: sam logs -n ENTER_YOUR_CONSUMER_FUNCTION_NAME.

Cleanup

1. Delete the stack: sam delete --stack-name STACK_NAME.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Parnab Basak

Parnab Basak

Parnab is a Solutions Architect for the Service Creation team in AWS. He specializes in creating net new solutions that are cloud native using modern s/w dev practices like Serverless, DevOps & Analytics.