Brief Introduction about AWS Lambda(Part 1)

Deepika Aggarwal
3 min readNov 7, 2020

As we all know that as technology is evolving the whole world is shifting to the cloud. When it comes to scalability, reliability, distributed system AWS has no replacement. AWS provides a lot of services that make a developer's life easy. AWS Lambda is one of these services. If you are a beginner to AWS and first want to focus on understanding concepts then believe me this post is for you. You are at the right place.

In a lot of organizations, it is the responsibility of the DevOps person to handle the AWS account. But as a developer, it is always advisable to understand and learn about AWS services. So, let’s start and learn something new.

Serverless Architecture

What do we understand by Serverless? Yes, you are right. Serverless means no server. But how is it possible without a server? As the server is the necessary thing to deploy any piece of code. But, it is possible. Let's see ….

AWS Lambda is a fully managed service that takes care of all the infrastructure for you. We don’t need to deploy our code(backend service) on Aws instances. We make Lambda function, write our logic in code, and tell when(event) needs to run this lambda function. This is all that we need to do. Aws lambda internally take instances and do all things for us. Let's take an example and understand it better.

I need to maintain an entry in DB (*dynamo DB ) whenever there is any new file uploaded in the S3 bucket. We will do it by AWS lambda but first, understand our use case and identify components

Event:- New upload on S3 bucket

Action :- Save file size ,file extension,file name in dynamoDB.

Lambda Function:- That will be a code to extract file properties and save in dynamo DB.

Aws Lambda Working

The Most Important Question that comes into mind is Why I should use Lambda? This question is very obvious that should come into mind that when we have Aws instances then why should I use AWS lambda? What are the pros and cons? Can lambda be used for all backend services, If it is then why people are still taking AWS instances? Let's compare AWS instances and Lambda hand in hand

  1. AWS Lambda functions are billed by the millisecond of CPU time, instead of as a flat and scaling fee based on usage. If in 24 hours our code run only for 1 hour that we should be charged only for 1 hour while EC2 instances are charged on a flat and scaling based model.
  2. With AWS Lambda we have no control over the environment. We are not able to custom install packages or software on the running environment. If our code has extra OS needs, it may need to be adapted — or hosted with another service entirely! While launching EC2 instances we can install packages and can host other OS also.
  3. The maximum function timeout for AWS Lambda is 15 min and memory is 3008MB. So if we have a service that takes more than 15 minutes to give response or computation time with high memory , that is not possible by AWS Lambda.
  4. 4. AWS Lambda is a fully managed service. So we don't need to take care when there is a high load. It is managed by AWS itself.

Conclusion

We can conclude that it totally depends on the use case of whether AWS lambda is a good use or not . In the next article, I will describe step by step process to make a lambda function. We will make a lambda function for the above example. Stay tuned. Stay healthy.

--

--

Deepika Aggarwal

Senior Software Enginer at TO THE NEW. Passionate about distributed System ,learning new things and spread knowledage across people.