HomeToolsAbout

Lambda

What is it

The Lambda function handler is the method in your function code that processes events. When your function is invoked, Lambda runs the handler method. Your function runs until the handler returns a response, exits, or times out.

Lambda Development Strategy

Create a simple lambda function through AWS UI

Upload main code ⇒ run tests ⇒ fix ⇒ repeat in the UI

Export and convert to Terraform

  • Actions > Export Function

Can run test the fully lambda run in AWS console locally

Environment Variables

To list your environment variables here for quick reference, use the keyboard shortcut (For macOS, press 'Command-Shift-E' for Windows 'Ctrl-Shift-E') or choose Tools, Show Environment Variables.

Environment variables remain encrypted when listed in the console code editor. If you enabled encryption helpers for encryption in transit, then those settings remain unchanged. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-encryption.

This file is read-only and is only available on the Lambda console. This file is not included when you download the function's .zip file archive and you can't add environment variables by uploading this file. To add or edit environment variables, choose Configuration, then choose Environment variables.

event and context

def handler_name(event, context): ... return some_value

context holds python function information like function_name

Retry Logic

Lambda does not automatically retry these types of errors on your behalf.

  • Your function's code might have run completely, partially, or not at all.

To retry, you can manually re-invoke your function, send the failed event to a queue for debugging, or ignore the error.

If you retry, ensure that your function's code can handle the same event multiple times without causing duplicate transactions or other unwanted side effects.

AboutContact