The Function Code Package - Serverless Architectures with AWS Lambda

The Function Code Package

The function code package contains all of the assets you want to have available locally upon execution of your code. A package will, at minimum, include the code function you want the Lambda service to execute when your function is invoked. However, it might also contain other assets that your code will reference upon execution, for example, additional files, classes, and libraries that your code will import, binaries that you would like to execute, or configuration files that your code might reference upon invocation. The maximum size of a function code package is 50 MB compressed and 250MB extracted at the time of this publication. (For the full list of AWS Lambda limits, see this documentation.)

When you create a Lambda function (through the AWS Management Console, or using the CreateFunction API) you can reference the S3 bucket and object key where you’ve uploaded the package. Alternatively, you can upload the code package directly when you create the function. Lambda will then store your code package in an S3 bucket managed by the service. The same options are available when you publish updated code to existing Lambda functions (through the UpdateFunctionCode API).

As events occur, your code package will be downloaded from the S3 bucket, installed in the Lambda runtime environment, and invoked as needed. This happens on demand, at the scale required by the number of events triggering your function, within an environment managed by Lambda.