I'm trying to use an MSK Lambda trigger with a Lambda that is connected to a VPC.
However, when deploying the Lambda I'm always getting this error:
Last processing result: PROBLEM: Connection error. Please check your event source connection configuration.
What I've tried:
- The lambda has all the required permissions as listed in https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html
- The lambda is inside the same VPC as the MSK cluster, I even deployed another lambda that can successfully produce messages in Kafka, with the exact same VPC configuration.
- The subnets have a NAT Gateway attached and an internet gateway
- The security group allows all incoming/outgoing traffic in all ports
What else can I try? What could be missing? I'm using this integration from the serverless framework.
Edit: alright, the problem is the security group of the MSK cluster.
The docs mention that you need this rule:
Inbound rules – Allow all traffic on all ports for the security group specified as your source.
But is there a way to be more restrictive rather than allowing traffic from everywhere?