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
MSK support as an event to trigger Lambdas #8117
Comments
@safv12 thanks for proposal. We're definitely open for that. Can you outline how kafka event properties will translate to CloudFormation template? Are those listed properties the only properties we intend to support? |
Hello team 👋 I was recently looking at how it's supported at CloudFormation level and how well that could fit into what is already supported by Serverless Framework. Underneath, it's using the same
|
@pgrzesik great thanks for sharing that.
I fully agree, seems as right to me
Which properties do you think should be mandatory for |
Hey 👋 @safv12 I agree here, One note on the |
@pgrzesik should we define the ConsumerGroupId in the trigger definition or it should be optional? |
Great thanks @safv12 and @pgrzesik for valuable insight!
I'd say let's follow with what we did in EFS, so stick to singular notation (unless we have a clear hint from AWS that it's likely to change soon). Summarizing above (and after going through AWS docs) I think in context of MSK we may have following options.
Having that outlined, I wonder weather before bringing support for MSK, shouldn't we refactor currently supported streaming events (as backed by Current situation is that we have Additionally in them I see following issues and in-consequences:
Implementation proposal1. Introduce
|
Hello 👋
I totally agree with that. As for the available options, I'm not sure if all of the listed options are available for MSK (and SQS as well). If I understand the docs correctly, the ones that are supported for MSK are the ones I listed, I was following the CloudFormation doc as well as these documents:
The second one states that:
So I think we have to remove these from the proposal, as they're not supported by As for the implementation proposal points:
I really like this idea - even though they're similar in functionality they offer, they have different defaults e.g. for
As I mentioned above, I'm not sure if there's any functionality missing for
👍
Makes a lot of sense, I believe trying to scramble it all in one PR will be harder to maintain and wrap up in a reasonable time. Do you feel like this refactoring/deprecation should be introduced before v2 release? |
@pgrzesik great thanks for pointing that, I didn't get initially that (Streams) in AWS docs narrows just to DynamoDB and Kinesis, good we have that clear now.
Yes it's indicated in CF config that it's only for streams In light of that, my idea of unifying generation of
It's not a requirement, we're also moving to more frequent release process (v3 is likely to be released 2-3 months after and so on). To fit it into v1 (and drop support for I've moved concern of deprecating Having that sorted out I believe list of supported properties for
|
Sorry @safv12 for missing your question in my previous message. It's not possible to directly define ConsumerGroupId in the trigger definition, or rather, AWS Lambda integration with MSK automatically creates a ConsumerGroup with an id equal to id of
@medikoo You're totally right - I tunnel-visioned into refactoring potentially making things easier, but implementing
To be fair, I believe I've somehow misread the docs because I thought the
That proposal looks great 👍 Just to clarify, should we also support |
I see it was picked here #2250 by @pmuens but no details on why Do you see it problematic to use it as default for
Good question. I guess it's an important setting for cases where we want to turn off given event mapping temporarily, and that after restart it starts from position where it stopped and not e.g. from begining (as it would be with Therefore we definitely should have that. I've updated top issue description with properties spec, let's keep there final version. |
I don't - I believe we should stick to the current default. I think it's application-specific and if current default fared well for 4 years now it sounds like the perfect choice 👍 @safv12 do you plan to implement support for |
@pgrzesik go ahead, for now, I am content with being part of the review of the pull request to learn a bit. If you need help with something I am open to help, just tell me. |
Super glad to see the support for msk released 🙌 Posting the related issue with msk support for typescript definitions: hope it gets resolved soon and really looking forward to using it |
This may be a long shot and don't mean to hijack this thread but would anyone be able to point me in the right direction for this question. What happens when a message/batch fails to be processed by the lambda function? Is it not ACKed and is expected to be replayed on the next fetch? Is it forever lost? What are the delivery semantics with this integration? Cheers |
Does this support SASL/SCRAM authentication? I was browsing the repo and confirmed there is SASL auth for self-managed kafka clusters (https://github.com/serverless/serverless/blob/ff605018a70a7156b0ca021adb080a4b4e0f2ede/docs/providers/aws/events/kafka.md), but no equivalent reference for msk events. |
Hello @pedrocava - there's in fact support for SASL for self-managed Kafka - I'm not sure if MSK does even support SASL/SCRAM auth with Lambda - based on the CF docs (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-sourceaccessconfiguration.html) it seems like it's only possible to configure it for self managed kafka. Please let us know if this is possible and we're definitely open to support it if that's the case |
This page lists Either way, is there something to look out for if passing MSK broker endpoints to a self-managed |
Hey @pedrocava, could you clarify a bit what do you mean with your question? I'm not sure I understand it. |
Sure! My bad, it wasn't clear at all. My team runs an MSK cluster with SASL auth - a choice made expecting it'd work fine with Lambda, which I'm starting to regret. Since there's no support for it through the MSK event, I'm thinking about defining a kafka event and passing our MSK brokers' endpoints to it, treating it as if it were a self-managed kafka cluster. The docs say I can pass the secret stored on AWS Secrets Manager I associated with the cluster as an AWS ARN, which is just what I needed. Does it sound like a bad idea, is there anything I should look out for? |
@pgrzesik, look what I found:
MSK does support SASL/SCRAM auth with Lambda |
Thanks for sharing your finding @pedrocava 🙇 Looks like something added a bit later than |
MSK is not automatically triggering while using in serverless.yml file, I have to manually trigger after lambda is deployed, can anyone help?? |
@vamshi1997 Could you please describe in more detail what exactly the problem is in your case? We have an integration test for |
Hi @pgrzesik, Using github actions I am triggering serverless.yml file, Which contains a lambda definition with msk topic as trigger, My code in serverless look like this but still after deployment it is not adding the trigger to the lambda, I tried replacing msk with the events with Kafka. |
Hello @vamshi1997 - please move your question to Github Discussions or to forum.serverless.com as it seems you have an issue with configuration and it's not a bug in the Framework itself. Documentation: https://www.serverless.com/framework/docs/providers/aws/events/msk/ |
Ok thanks |
Lambda now supports Amazon MSK as an event source, so it can consume messages and integrate with downstream serverless workflows. It will be great to have a Kafka event to trigger the functions from serverless.
https://aws.amazon.com/es/blogs/compute/using-amazon-msk-as-an-event-source-for-aws-lambda/
Proposed solution
(Updated on the go, to reflect final agreement):
Event name
msk
, with support for following properties:batchSize
: optional, maps toBatchSize
arn
: required, maps toEventSourceArn
enabled
: optional, maps toEnabled
startingPosition
: optional (but required in AWS), maps toStartingPosition
with default set toTRIM_HORIZON
topic
: required (technically optional in AWS, but it's due to implied support for other stream sources), maps toTopics[0]
The text was updated successfully, but these errors were encountered: