Define a handler per http event

Is there any way to combine multiple handlers into one lamda function without defining all the routing handler glue code?
Honestly: serverless-delivery-framework?

When you create a Lambda you need to specify the handler function. This is an AWS requirement and not something imposed by the Serverless framework. If you want to a single Lambda function to handle different events you need to route everything through a single handler function inside the Lambda.

You can create multiple Lambda functions from a single source by exporting multiple handlers and then telling each Lambda to use a different handler.

I don’t think there’s one correct way to handle this. The advantage of the first approach is that your Lambda is less likely to need a cold start if you’re sending lots of events through it.

1 Like