Deploy MSK Cluster and AWS SAM project with AWS Lambda to demonstrate SASL authentication

Amazon MSK → AWS Lambda

Create an AWS Lambda function that uses an Amazon MSK Topic as an event source.

This pattern provides two resources -
- An Amazon CloudFormation template to deploy a serverless or provisioned MSK cluster and Cloud9 instance in the same VPC to interact with the MSK cluster
- An AWS SAM project with a Lambda Function to demonstrate SASL authentication.
To test this pattern, first deploy the CloudFormation stack using the template file MSKSampleStack.yml under msk-cfn-sasl-lambda/create-cluster-cfn. You will need to chose if you'd like to provision serverless or provisioned cluster. For both options, all available authentication mechanisms are enabled - TLS, SASL/SCRAM, and IAM for provisioned cluster, and IAM for serverless. Follow msk-cfn-sasl-lambda/create-cluster-cfn/README.md for detailed instructions
Next step is to deploy the Lambda Function. Follow steps under msk-cfn-sasl-lambda/README.md to deploy and test the Lambda Function.
Note - Presently MSK with serverless is not supported for SASL authentication, you must use Provisioned option when deplying the MSK cluster.

< 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-cfn-sasl-lambda

Deploy

sam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the Lambda Function: sam delete.
Delete CloudFormation stack to delete the MSK stack and associated resources.

Created by:

Vaibhav Jain

Vaibhav Jain

AWS - Sr. Application Architect

Follow on LinkedIn

Paveen Allam

Paveen Allam

Senior Solutions Architect

Follow on LinkedIn

Suraj Tripathi

Suraj Tripathi

AWS - AppDev Cloud Consultant

Follow on LinkedIn

Adam Wagner

Adam Wagner

AWS - Principal Serverless Solutions Architect

Follow on LinkedIn

Indranil Banerjee

Indranil Banerjee

AWS - Senior Solutions Architect

Follow on LinkedIn