How I use make to update AWS lambda

The make tool is convenient because it's likely already installed on your Mac or Linux computer.

I usually create the lambda through AWS console but push new code with make.

This is for python where you have to zip the files first, other runtimes are a little bit easier. Actually container might be your best overall choice but this will let you see and edit code from console for ad hoc changes.

I know you're supposed to mark build targets like these .PHONY when they don't produce an output, sue me, this is my version of an entire startup in a php-file.

                        
# auth might vary, this uses a profile in ~/.aws/credentials
build: 
    zip my_lambda.zip *.py

update: build
    aws lambda update-function-code \
    --profile my-profile \
    --region eu-north-1 \
    --function-name my-lambda-function-name \
    --zip-file fileb://my_lambda.zip

status:
    aws lambda get-function \
    --profile my-profile \
    --region eu-north-1 \
    --function-name my-lambda-function-name \
    --query 'Configuration.[State, LastUpdateStatus]'

                        
                    

Now you can simply hack away and do

                        
> make update
> make status
                        
                    

How does Narratrail help?

If you had been running Narratrail you would get this helpful message posted when you update your lambda. Now you (in 2 months) and your team now who made the last change!

Narratrail in Slack