RamPrakash
RamPrakash

Reputation: 3322

Organizing lambda functions

In traditional application development using Spring-boot / nodeJS, we have a controller/router in which we create different methods to handle appropriate HTTP request

Reservation Controller / Router
    GET getReservation(id)
    POST createReservation()
    PUT updateReservation()
    GET getAllReservation()

Controller/router calls the service classes to get the job done. Assume that you have multiple controller/service classes like this.

Now my quesiton is, If I need to create similar application using AWS lambda, I have to create multiple lambda functions separately which do not seem to be organized under a controller. (I understand that API Gateway is the controller here - please correct me if it is not). How to organize lambda functions / what is best practise you follow for your serverless architecture?

Upvotes: 3

Views: 1441

Answers (1)

Kannaiyan
Kannaiyan

Reputation: 13055

There is no strict architecture to develop what you want. It depends on your need for isolation and maintenance. You can do it either way with Lambda.

If your code is small enough for all methods. You can perform ANY integration with API Gateway, that will get all the methods under control of single Lambda.

If you want to separate the code to own lambda's, you can create independent lambda and deploy them separately. If you have dependent libraries across all of your methods, you can share them with Lambda Layers.

Both of the above approaches discussed here

Hope it helps.

Upvotes: 2

Related Questions