When building REST API with AWS Lambda + Java, do you define all lambda functions in a single AWS SAM template or create a separate project for each CRUD operation?

Given that on AWS, each lambda function runs in its own container, and only one handler class is invoked per HTTP Method. It makes sense to define each Lambda Handler class in its own separate AWS SAM project.

Do you define each Handler class in its own AWS SAM project, or put all CRUD operations into a single SAM template anyways?

  • 2
    I don't have experience building AWS Lambdas for Java, but don't you find it overkill to have a separate project per CRUD operation? I would leave the task of packaging and deploying separate lambdas to the build tools.
    – edalorzo
    Oct 12, 2021 at 1:39
  • Yes, I do find it an overkill as well. Thank you, @edalorzo! Oct 12, 2021 at 17:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.