AWS Lambda Configuration

  • What is an AWS Lambda and What is it Used For?

~It’s simply a form of responsive cloud service.

~It checks activity within the application and responds by distributing codes, as in functions, defined by the user.

~It maintains the compute resources across a number of availability zones, and it automatically scales them upon the triggering of new actions.

~It only works with codes of Node.js, Python and Java. The service can also run processes in languages that work with Amazon Linux such as Bash, Go & Ruby.

  • Things to know while using AWS Lambda:

~The Lambda function code should be written in a stateless style.

~No function variable should be declared outside of the reach of the handler.

~Sets of +rx permissions should be found on files of uploaded ZIP in order to make sure that Lambda will be able to execute this code for you.

~Old Lambda functions should be surely erased when they are not needed any more.

  • How is Lambda Configured?

>First: Go and sign into your AWS account.

>Second: Head to AWS Services section and choose Lambda under “Compute”.

>Third: Click on Create Function on top right. A new form will open.

>Fourth: Before proceeding click on the Blueprint box in the center. Type the word “Hello” in the search box, and press Enter. Select the Blueprint with the name “hello-world-python” and click Configure.

>Fifth: Fill in the required information in order to create a Lambda function. Choose a unique name for your function, put the Execution role as “existing role”, and select the basic execution role for the Existing role box.

>Sixth: Click on the Create Function button, and you’ve got yourself a new function.

  • Benefits of AWS Lambda

+Its tasks don’t require being registered as Amazon SWF activity types require.

+Any pre-defined Lambda function in workflows can simply be used.

+Amazon SWF directly calls Lambda functions; no program is required to be created in order to implement and run them.

+It allows us to have the necessary metrics and logs so that we are able to track function executions.

  • AWS Lambda Limits

-Limited Throttle

The maximum amount of throttle allowed is the execution of 100 concurrent Lambda Functions for each account. It includes the total concurrent executions of all functions found within the same region.

Formula for the calculation of the number of concurrent executions per function:

(Average Duration of the Function Execution) X (Number of Requests or Events Processed by AWS Lambda).

Upon reaching throttle limit, an error will be returned having the code 429. When the duration of fifteen to thirty minutes passes, work can be resumed. You can increase the throttle limit by contacting AWS support center.

-Limited Resources

The below figure illustrates the resources limits for a Lambda function:     

ResourceDefault Limit
Ephemeral disk capacity ("/tmp" space)512 MB
Number of file descriptors1,024
Total number of processes and threads1,024
Maximum execution duration per request300 seconds
Invoke request body payload size6 MB
Invoke response body payload size6 MB

-Limited Service

The figure below illustrates the services limits for deploying a Lambda function:

ItemDefault Limit
Lambda function deployment package size (.zip/.jar file)50 MB
Size of code/dependencies that you can zip into a deployment package (uncompressed zip/jar size)250 MB
Total size of all the deployment packages that can be uploaded per region1.5 GB
Number of unique event sources of the Scheduled Event source type per account50
Number of unique Lambda functions you can connect to each Scheduled Event5

See Also

Scaling AWS Lambda