Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming conventions for AWS Lambdas intended for REST API access

I'm building an API with the Serverless framework. Endpoints are defined on Amazon API Gateway, where each signature is mapped to an individual Lambda.

What is a good naming convention for the Lambdas here? For example, the candidates for POST /user could be:

  • userPost
  • createUser
like image 412
Danyal Aytekin Avatar asked Oct 14 '25 20:10

Danyal Aytekin


1 Answers

Naming is always tough.

For general naming - this is a good answer: https://softwareengineering.stackexchange.com/a/130104

In addition, the scope of the namespace of your lambda functions is a consideration - e.g. if all of your functions relate to users in application XYZ for enterprise ABC, then create is sufficient.

However, if you have lambda functions for both enterprises ABC & DEF, and each have multiple applications with user management and may need different create methods for different things, then you may need something like AbcApplicationxyzCreateUser.

One other comment - in English, commandObject (e.g. createUser) reads better and sounds more natural when said aloud compared to objectCommand (e.g. userCreate). But I have found it easier to have the contextual parts (e.g. company or application ; if needed, but better avoided if possible) at the start as it facilitates tools to organize methods better (contextCommandObject e.g. AbcCoCustomerServiceAppCreateUser).

In short, make it simple, avoid using anything that is implicitly obvious, but allow for distinguishing between different applications/systems/entities in the namespace if needed.

like image 62
Brian Quinn Avatar answered Oct 17 '25 11:10

Brian Quinn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!