Top serverless mistakes
What mistakes are people making when adopting serverless?
Published: Friday, Jun 30, 2023 Last modified: Monday, Dec 9, 2024
Using API gateway routing instead of a catchall
Aka Functions calling each other directly/coupling functions
Aka using Step Functions 🤦♂️
Aka splitting up a application for no good reason and not practicing Monolith First
Events:
CatchAll:
Type: HttpApi
Properties:
ApiId: !Ref Gateway
Path: /{proxy+}
Method: ANY
Putting the whole application into one lambda is best practice in my eyes and is also known as “fat lambdas” by some.
Not keeping to the standard http interface
Aka breaking local development
For Javascript users, use serverless-http to abstract away the awkward AWS Lambda interface.
For Go users, use Apex Gateway v2
And whilst I have your attention, please use structured logs!
Not using a framework
Aka using Terraform or Cloudformation for orchestrating lambdas and finding it awkward.
Leveraging the AWS runtime requires some boilerplate to:
- Setup a role & policy
- Setup a lambda runtime
- Setup a bucket for the code
Doing this from scratch (or in Terraform) is error prone and time consuming.
I recommend using AWS SAM Aka AWS::Serverless-2016-10-31
.
Thanks for contributing Rich Buggy, Yan Cui & Jordan Finneran!