Noob question: Do I need a lambda to put an event on a stream?

I’m still trying to get the basic flow down here:

So a request hits my API gateway. Where do I define the model? Does the gateway deserialize the request and validate the body is valid per the endpoint definition or is that the job of the lambda? Then that lambda puts the event into Dynamo or on a Kenisis stream?

Lets say I’ve got a request CreatePurchaseRequest when would I go API Gateway > lambda (validate request and save) > DynamoDB > lambda (send e-mail. triggered by row insert)
versus

API Gateway > lambda (validate request and put on stream) > Kinesis > DynamoDB and email lambda both subscribe to it

The lambda function will put the item into Dynamo or into an sns topic (or kinesis) via the aws-sdk inside the lambda function.

See https://github.com/DavidWells/serverless-workshop/blob/master/lessons/events/sns/sns-basic/handler.js#L15-L25 for an sns example. There are additional examples inside /events folder of that repo

1 Like