How to develop your Lambda Functions like a rockstar

This post is for me if:

  • I want to see best practices for developing Serverless Architecture.
  • I am researching Serverless Applications and the best tools available.
  • I want make my development time more efficient when building against AWS Lambda.
  • I am looking for real-world development experience and not “hello world” examples.
  • I want to become an AWS Lambda ninja.

First Up: Pick your toolset

Next: Write your function and Test Locally

serverless invoke local --function get_user

Introduce event JSON into the mix

> sam local generate-event apigateway aws-proxy{
"body": "eyJ0ZXN0IjoiYm9keSJ9",
"resource": "/{proxy+}",
"path": "/path/to/resource",

Locally Invoking with your Event Data

python | sls invoke local -f get_user
import jsonbody = json.dumps({
'hello': 'world',
'some_other': 'data',
'is_awesome': true
event = json.dumps({
'body': body, # insert Stringified JSON body here
'requestContext': {
'authorizer': {
'user_id': '1234',
'pathParameters': {
'some_path_param': '1234'

Debugging the local execution of your function

Deploy your function & Double Check

Run the same JSON against our deployed function

  1. What IAM Permissions does your function have?

Run it in the wild

Odd reasons your function may not be working

That’s it! 👏



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store