Menu
AWS Lambda
Developer Guide

Lambda Execution Environment and Available Libraries

The underlying AWS Lambda execution environment is based on the following:

  • Public Amazon Linux AMI version (AMI name: amzn-ami-hvm-2016.03.3.x86_64-gp2):

    For information about using an AMI, see Amazon Machine Images (AMI) in the Amazon EC2 User Guide for Linux Instances.

  • Linux kernel version – 4.4.23-31.54.amzn1.x86_64

If you are using any native binaries in your code, make sure they are compiled in this environment. Note that only 64-bit binaries are supported on AWS Lambda.

AWS Lambda supports the following runtime versions:

  • Node.js – v0.10.36, v4.3.2 (recommended)

  • Java – Java 8

  • Python – Python 2.7

  • .NET Core – .NET Core 1.0.1 (C#)

The following libraries are available in the AWS Lambda execution environment, regardless of the supported runtime you use, so you don't need to include them:

AWS SDK – AWS SDK for JavaScript version 2.6.9

The following libraries are available in the AWS Lambda execution environment so you don't need to include them:

  • AWS SDK for Python (Boto 3) version 1.4.1, Botocore version 1.4.61

  • Amazon Linux build of java-1.8.0-openjdk for Java.

Environment Variables Available to Lambda Functions

The following is a list of environment variables that are part of the AWS Lambda execution environment and made available to Lambda functions. The table below indicates which ones are reserved by AWS Lambda and cannot be changed as well as which ones you can set when creating your Lambda function. For more information on using environment variables with your Lambda function, see Environment Variables.

Lambda Environment Variables

KeyReservedValue
LAMBDA_TASK_ROOTYesContains the path to your Lambda function code.
LAMBDA_RUNTIME_DIRYesRestricted to Lambda runtime-related artifacts. For example the aws-sdk for Node.js and boto3 for Python can be found under this path.
AWS_REGIONYesThe AWS region where the Lambda function is executed.
AWS_DEFAULT_REGIONYesThe AWS region where the Lambda function is executed.
AWS_LAMBDA_LOG_GROUP_NAMEYesThe name of Amazon CloudWatch Logs group where log streams containing your Lambda function logs are created.
AWS_LAMBDA_LOG_STREAM_NAMEYesThe Amazon CloudWatch Logs streams containing your Lambda function logs.
AWS_LAMBDA_FUNCTION_NAMEYesThe name of the Lambda function.
AWS_LAMBDA_FUNCTION_MEMORY_SIZEYesThe size of the Lambda function in MB.
AWS_LAMBDA_FUNCTION_VERSIONYesThe version of the Lambda function.

AWS_ACCESS_KEY

AWS__ACCESS_KEY_ID

AWS_SECRET__KEY

AWS_SECRET_ACCESS_KEY

AWS_SESSION_TOKEN

AWS_SECURITY_TOKEN

YesThe security credentials required to execute the Lambda function, depending on which runtime is used. Different runtimes use a subset of these keys. They are generated via an IAM execution role specified for the function.
PATHNoContains /usr/local/bin, /usr/bin or /bin for running executables.
LANGNoSet to en_US.UTF-8. This is the Locale of the runtime.
LD_LIBRARY_PATHNoContains /lib64, /usr/lib64, LAMBDA_TASK_ROOT, LAMBDA_TASK_ROOT/lib. Used to store helper libraries and function code.
NODE_PATHNoSet for the Node.js runtime. It contains LAMBDA_RUNTIME_DIR, LAMBDA_RUNTIME_DIR/node_modules, LAMBDA_TASK_ROOT.
PYTHON_PATHNoSet for the Python runtime. It contains LAMBDA_RUNTIME_DIR.

Suggested Reading

If you are new to AWS Lambda, we suggest you read through all of the topics in the How It Works section to familiarize yourself with Lambda, starting with How It Works.

After you read all of the topics in the How it Works section, we recommend that you review Building Lambda Functions, try the Getting Started exercise, and then explore the Use Cases. Each use case provides step-by-step instructions for you to set up the end-to-end experience.