Every Lambda function I write starts in the same way: a bunch of code to unpack the event and then validate its contents. Sound familiar?

Moreover, I can never remember the exact key names for certain event payloads. How do I get the headers from an ApiGateway event again? Is it headers or Headers?

Oh right, it’s headers andmultiValueHeaders. Of course it is.

So each new Lambda function I create starts off in a very similar way to every other Lambda function I create:

  • Googling for event payload structures.
  • Unpacking the contents and calling json.loadsto turn strings into dicts.
  • Validating the contents.

#serverless #aws-lambda #aws #python

Simple Serverless: Neat and Tidy Lambda Functions Use Powertools
17.95 GEEK