DEV Community

Cover image for Have You Heard About AWS Lambda?
Paloma Lataliza for AWS Community Builders

Posted on • Originally published at Medium

Have You Heard About AWS Lambda?

AWS Lambda is a Serverless service, that is, serverless computing. Also known as a function, it is event driven, executing code and managing the computing resources that are required in this code that has been executed.

Image description


WHAT ARE THE BENEFITS OF LAMBDA?

When we use lambda in our scenarios, we can see the following benefits:

  • Instant Scalability: When high access flows occur, you can automatically scale your function to serve a greater number of clients without having to worry about pre-allocating more servers.

  • Reduced Amount of Code: With lambda functions we can go straight to the point and execute only what is necessary, without worrying about database connections, route management and other configurations, as they will be performed in other services.

  • No Idle Resource Charges: With Lambda, you don’t have to pay for idle resources on an EC2, even with the smallest possible machine.

Lambda functions are supported in Node.js programming languages: v8.10 and v6.10, Java 8, Python: 3.6 and 2.7, .NET Core: 1.0.1 and 2.0, Go 1.x

Each function runs in an Amazon Linux 64-bit container. And the execution environment follows the specifications you configure. It is worth noting that we cannot control the CPU as it allocates according to RAM usage. We can request the functions through two event models, push and pull.

To talk about your function settings we need to see the following points:

  • Execution Role: This is the role that AWS Lambda performs on your behalf when executing a lambda function.
    Maximum Execution Time : When we talk about maximum execution time, we can say that it is the maximum time that a Lambda function can run without being interrupted. Upon timing out, AWS Lambda is terminating the execution of your Lambda function. The recommended configuration is evaluated at the expected runtime.

  • Temporary HD: The temporary HD is made available in the form of a /tmp directory and you will only be able to use this temporary disk space for the current function.
    Packaging: In order to be able to send our functions to AWS, it is necessary to compress them and most of the time we perform this action by compressing it together with all its dependencies. With that part finished, we’ll upload it to an S3 bucket.

  • The Handler Name: Is the entry point method that executes your lambda function code with any event source dependencies included as part of your lambda function. You can discover more details and quality resources for monitoring and debugging AWS Lambda and its lambda functions.





COST

The amount to be charged is only for the time your function will take to execute. The charge is made from when your function starts executing until the result is returned and the time your container is online without any function being executed is not charged.




WHEN NOT TO USE LAMBDA?


It is worth mentioning that there are some situations where it is not interesting to use Lambda such as:

  • Handling Very Large Files: Handling files by lambda takes place on an ephemeral, low-capacity disk, making it impossible to handle very large files in a function. Therefore, it is necessary to resort to an external storage service such as S3.

  • Long Running: A function’s execution timeout is 15 minutes. This can happen when processing a large volume of data at once.

  • Run a Traditional web application: When we use the entire application in a single function, it happens that we run unnecessary code snippets, as well as configurations that can be performed in other services.

Using lambda can be a great option to reduce costs and gain performance, but you must first understand your scenario.

Top comments (0)