Lambda Function Code - Serverless Architectures with AWS Lambda

Lambda Function Code

At its core, you use Lambda to execute code. This can be code that you’ve written in any of the languages supported by Lambda (Java, Node.js, Python, or C# as of this publication), as well as any code or packages you’ve uploaded alongside the code that you’ve written. You’re free to bring any libraries, artifacts, or compiled native binaries that can execute on top of the runtime environment as part of your function code package. If you want, you can even execute code you’ve written in another programming language (PHP, Go, SmallTalk, Ruby, etc.), as long as you stage and invoke that code from within one of the support languages in the AWS Lambda runtime environment (see this tutorial).

The Lambda runtime environment is based on an Amazon Linux AMI (see current environment details here), so you should compile and test the components you plan to run inside of Lambda within a matching environment. To help you perform this type of testing prior to running within Lambda, AWS provides a set of tools called AWS SAM Local to enable local testing of Lambda functions. We discuss these tools in the Serverless Development Best Practices section of this whitepaper.