Before I answer this question, let’s understand about AWS compute services and that too Lambda in details.
AWS Compute Domain
Following are the main services in the compute domain –
EC2 – Most important is EC2 service, It’s like your Personal computer in which you are working remotely. You can install any OS which is supported by AWS and you can work on it as per your needs.
Elastic Beanstalk – Which is an automated version of EC2, where you will not have permissions to access OS but you will have control on configurations. Beanstalk used to deploy applications basically we upload the code and our application automatically get deployed on AWS infrastructure.
AWS Lambda – It is a server less compute service (an automated version of EC2 instance) that runs your code in response to events, where you don’t have to access any OS or even have to configure your server. Simply you just need to upload the code and it will be executed on the respective trigger.
Why AWS Lambda?
- Lambda is a compute service (where actual computation will AWS happen) which enables you to run your business logic without having to provision or manage any servers.
- Lambda code will run on top of AWS infrastructure, leaving developers worry-free from infrastructure management.
- AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second.
- AWS Lambda offers following features
- High-availability compute infrastructure and manages the affairs of compute resources
- Operating system maintenance
- Capacity provisioning and automatic scaling, AWS Lambda will dynamically scale capacity in response to increased traffic. https://docs.aws.amazon.com/lambda/latest/dg/scaling.html
- Code monitoring and logging.
When Should I Use AWS Lambda?
AWS Lambda is the platform with computational power which can be used in various application use cases. As of today, it is supporting the application development in the following languages:
And runs within the AWS Lambda standard runtime environment.
When using AWS Lambda, you are responsible only for your code irrespective of the languages whether it is Java development or Python development or any other. AWS Lambda manages the compute resources that offers a perfect balance across different parameters like memory, CPU, network, etc. This is of course, in exchange to flexibility, meaning you cannot log in to AWS account and customize compute instances in terms of the operating system or language runtime.
Event Driven Model
AWS Lambda functions will be invoked against various preconfigured events, including events from AWS services such as:
- S3 (such as changes to S3 buckets)
- DynamoDB (such as updates to a table in the database)
- CloudWatch (such as as a response to an alarm)
- and AWS IoT
- This platform can also enable function calls based on following hooks
- inbound messages (Kinesis, SNS)
- incoming HTTP requests (API Gateway)
- by a scheduled event
Here we can see one scenario where
- We will upload a CSV file to an S3 Bucket, which triggers a Lambda function.
- The Lambda function reads the CSV file and sums each line, which consists of comma separated numbers.
- SNS topic will publish the results and distribute to two subscribers
- SQS Queue, and
AWS Lambda Limits
AWS Lambda Resource Limits per Invocation (as taken from aws docs)
|Memory allocation range||Minimum = 128 MB / Maximum = 3008 MB (with 64 MB increments). If the maximum memory use is exceeded, function invocation will be terminated.|
|Ephemeral disk capacity (“/tmp” space)||512 MB|
|Number of file descriptors||1,024|
|Number of processes and threads (combined total)||1,024|
|Maximum execution duration per request||300 seconds (5 minutes)|
|Invoke request body payload size (RequestResponse/synchronous invocation) NOTE: The response body payload also must adhere to this limit.||6 MB|
|Invoke request body payload size (Event/asynchronous invocation)||128 KB|
AWS Lambda Account Limits Per Region
|Concurrent executions (see Managing Concurrency)||1000|
This is in my opinion, the biggest win. You pay only for the actual processing time you consume – when your code is sitting idle, your billing meter is down!
The Lambda free tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month.
Vishal Shah has an extensive understanding of multiple application development frameworks and holds an upper hand with newer trends in order to strive and thrive in the dynamic market. He has nurtured his managerial growth in both technical and business aspects and gives his expertise through his blog posts.
Build your Team
Want to Hire Skilled Developers